From ba579f30fca29fa86d5a0d7f846e451f5a094de3 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 10 Dec 2025 21:31:56 +0100 Subject: [PATCH 01/24] bump version --- Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 005fdc3..345432c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "T8code" uuid = "d0cc0030-9a40-4274-8435-baadcfd54fa1" authors = ["Johannes Markert "] -version = "0.7.4" +version = "0.7.5-DEV" [deps] CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82" @@ -22,4 +22,4 @@ Preferences = "1.2" Reexport = "0.2, 1.0" UUIDs = "1" julia = "1.6" -t8code_jll = "=3.0.1" +t8code_jll = "=4.0.0" From 0aa43dbbd342b6fe8ab58c3c5128114466cb9760 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 10 Dec 2025 21:32:10 +0100 Subject: [PATCH 02/24] initial commit fixes.sh not run yet! --- src/Libt8.jl | 16004 +++++++++++++++++++++++-------------------------- 1 file changed, 7536 insertions(+), 8468 deletions(-) diff --git a/src/Libt8.jl b/src/Libt8.jl index 97b434f..b75dc82 100644 --- a/src/Libt8.jl +++ b/src/Libt8.jl @@ -1,6 +1,6 @@ module Libt8 -using CEnum: @cenum +using CEnum: CEnum, @cenum to_c_type(t::Type) = t to_c_type_pairs(va_list) = map(enumerate(to_c_type.(va_list))) do (ind, type) @@ -67,6 +67,32 @@ const INT64_MIN = typemin(Clonglong) const INT64_MAX = typemax(Clonglong) +""" + sc_extern_c_hack_1() + +### Prototype +```c +SC_EXTERN_C_BEGIN; +``` +""" +function sc_extern_c_hack_1() + @ccall libt8.sc_extern_c_hack_1()::Cvoid +end + +""" + sc_extern_c_hack_2() + +` ` + +### Prototype +```c +SC_EXTERN_C_END; +``` +""" +function sc_extern_c_hack_2() + @ccall libt8.sc_extern_c_hack_2()::Cvoid +end + """ sc_abort_verbose(filename, lineno, msg) @@ -78,12 +104,12 @@ void sc_abort_verbose (const char *filename, int lineno, const char *msg) __attr ``` """ function sc_abort_verbose(filename, lineno, msg) - @ccall libsc.sc_abort_verbose(filename::Cstring, lineno::Cint, msg::Cstring)::Cvoid + @ccall libt8.sc_abort_verbose(filename::Cstring, lineno::Cint, msg::Cstring)::Cvoid end # automatic type deduction for variadic arguments may not be what you want, please use with caution @generated function sc_abort_verbosef(filename, lineno, fmt, va_list...) - :(@ccall(libsc.sc_abort_verbosef(filename::Cstring, lineno::Cint, fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + :(@ccall(libt8.sc_abort_verbosef(filename::Cstring, lineno::Cint, fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) end """ @@ -95,7 +121,7 @@ void *sc_malloc (int package, size_t size); ``` """ function sc_malloc(package, size) - @ccall libsc.sc_malloc(package::Cint, size::Csize_t)::Ptr{Cvoid} + @ccall libt8.sc_malloc(package::Cint, size::Csize_t)::Ptr{Cvoid} end """ @@ -107,7 +133,7 @@ void *sc_calloc (int package, size_t nmemb, size_t size); ``` """ function sc_calloc(package, nmemb, size) - @ccall libsc.sc_calloc(package::Cint, nmemb::Csize_t, size::Csize_t)::Ptr{Cvoid} + @ccall libt8.sc_calloc(package::Cint, nmemb::Csize_t, size::Csize_t)::Ptr{Cvoid} end """ @@ -119,7 +145,7 @@ void *sc_realloc (int package, void *ptr, size_t size); ``` """ function sc_realloc(package, ptr, size) - @ccall libsc.sc_realloc(package::Cint, ptr::Ptr{Cvoid}, size::Csize_t)::Ptr{Cvoid} + @ccall libt8.sc_realloc(package::Cint, ptr::Ptr{Cvoid}, size::Csize_t)::Ptr{Cvoid} end """ @@ -131,7 +157,7 @@ char *sc_strdup (int package, const char *s); ``` """ function sc_strdup(package, s) - @ccall libsc.sc_strdup(package::Cint, s::Cstring)::Cstring + @ccall libt8.sc_strdup(package::Cint, s::Cstring)::Cstring end """ @@ -143,7 +169,7 @@ void sc_free (int package, void *ptr); ``` """ function sc_free(package, ptr) - @ccall libsc.sc_free(package::Cint, ptr::Ptr{Cvoid})::Cvoid + @ccall libt8.sc_free(package::Cint, ptr::Ptr{Cvoid})::Cvoid end """ @@ -153,20 +179,20 @@ The central log function to be called by all packages. Dispatches the log calls # Arguments * `package`:\\[in\\] Must be a registered package id or -1. -* `category`:\\[in\\] Must be `SC_LC_NORMAL` or `SC_LC_GLOBAL`. -* `priority`:\\[in\\] Must be > `SC_LP_ALWAYS` and < `SC_LP_SILENT`. +* `category`:\\[in\\] Must be [`SC_LC_NORMAL`](@ref) or [`SC_LC_GLOBAL`](@ref). +* `priority`:\\[in\\] Must be > [`SC_LP_ALWAYS`](@ref) and < [`SC_LP_SILENT`](@ref). ### Prototype ```c void sc_log (const char *filename, int lineno, int package, int category, int priority, const char *msg); ``` """ function sc_log(filename, lineno, package, category, priority, msg) - @ccall libsc.sc_log(filename::Cstring, lineno::Cint, package::Cint, category::Cint, priority::Cint, msg::Cstring)::Cvoid + @ccall libt8.sc_log(filename::Cstring, lineno::Cint, package::Cint, category::Cint, priority::Cint, msg::Cstring)::Cvoid end # automatic type deduction for variadic arguments may not be what you want, please use with caution @generated function sc_logf(filename, lineno, package, category, priority, fmt, va_list...) - :(@ccall(libsc.sc_logf(filename::Cstring, lineno::Cint, package::Cint, category::Cint, priority::Cint, fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + :(@ccall(libt8.sc_logf(filename::Cstring, lineno::Cint, package::Cint, category::Cint, priority::Cint, fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) end """ @@ -185,7 +211,7 @@ struct sc_array elem_size::Csize_t elem_count::Csize_t byte_alloc::Cssize_t - array::Ptr{Int8} + array::Cstring end """The [`sc_array`](@ref) object provides a dynamic array of equal-size elements. Elements are accessed by their 0-based index. Their address may change. The number of elements (== elem\\_count) of the array can be changed by sc_array_resize and sc_array_rewind. Elements can be sorted with sc_array_sort. If the array is sorted, it can be searched with sc_array_bsearch. A priority queue is implemented with pqueue\\_add and pqueue\\_pop (untested).""" @@ -207,7 +233,7 @@ sc_array_t *sc_array_new_count (size_t elem_size, size_t elem_count); ``` """ function sc_array_new_count(elem_size, elem_count) - @ccall libsc.sc_array_new_count(elem_size::Csize_t, elem_count::Csize_t)::Ptr{sc_array_t} + @ccall libt8.sc_array_new_count(elem_size::Csize_t, elem_count::Csize_t)::Ptr{sc_array_t} end """ @@ -238,7 +264,7 @@ int sc_int32_compare (const void *v1, const void *v2); ``` """ function sc_int32_compare(v1, v2) - @ccall libsc.sc_int32_compare(v1::Ptr{Cvoid}, v2::Ptr{Cvoid})::Cint + @ccall libt8.sc_int32_compare(v1::Ptr{Cvoid}, v2::Ptr{Cvoid})::Cint end """A type for global indexing that holds really big numbers.""" @@ -253,33 +279,44 @@ int sc_int64_compare (const void *v1, const void *v2); ``` """ function sc_int64_compare(v1, v2) - @ccall libsc.sc_int64_compare(v1::Ptr{Cvoid}, v2::Ptr{Cvoid})::Cint + @ccall libt8.sc_int64_compare(v1::Ptr{Cvoid}, v2::Ptr{Cvoid})::Cint end """ - sc_shmem_malloc(package, elem_size, elem_count, comm) - -### Prototype -```c -void *sc_shmem_malloc (int package, size_t elem_size, size_t elem_count, sc_MPI_Comm comm); -``` -""" -function sc_shmem_malloc(package, elem_size, elem_count, comm) - @ccall libsc.sc_shmem_malloc(package::Cint, elem_size::Csize_t, elem_count::Csize_t, comm::MPI_Comm)::Ptr{Cvoid} -end + t8_eclass -""" - sc_shmem_free(package, array, comm) +This enumeration contains all possible element classes. -### Prototype -```c -void sc_shmem_free (int package, void *array, sc_MPI_Comm comm); -``` +| Enumerator | Note | +| :--------------------- | :----------------------------------------------------------------------------------------------------------------- | +| T8\\_ECLASS\\_VERTEX | The vertex is the only zero-dimensional element class. | +| T8\\_ECLASS\\_LINE | The line is the only one-dimensional element class. | +| T8\\_ECLASS\\_QUAD | The quadrilateral is one of two element classes in two dimensions. | +| T8\\_ECLASS\\_TRIANGLE | The element class for a triangle. | +| T8\\_ECLASS\\_HEX | The hexahedron is one three-dimensional element class. | +| T8\\_ECLASS\\_TET | The tetrahedron is another three-dimensional element class. | +| T8\\_ECLASS\\_PRISM | The prism has five sides: two opposing triangles joined by three quadrilaterals. | +| T8\\_ECLASS\\_PYRAMID | The pyramid has a quadrilateral as base and four triangles as sides. | +| T8\\_ECLASS\\_COUNT | This is no element class but can be used as the number of element classes. | +| T8\\_ECLASS\\_INVALID | This is no element class but can be used for the case a class of a third party library is not supported by t8code | """ -function sc_shmem_free(package, array, comm) - @ccall libsc.sc_shmem_free(package::Cint, array::Ptr{Cvoid}, comm::MPI_Comm)::Cvoid +@cenum t8_eclass::UInt32 begin + T8_ECLASS_ZERO = 0 + T8_ECLASS_VERTEX = 0 + T8_ECLASS_LINE = 1 + T8_ECLASS_QUAD = 2 + T8_ECLASS_TRIANGLE = 3 + T8_ECLASS_HEX = 4 + T8_ECLASS_TET = 5 + T8_ECLASS_PRISM = 6 + T8_ECLASS_PYRAMID = 7 + T8_ECLASS_COUNT = 8 + T8_ECLASS_INVALID = 9 end +"""This enumeration contains all possible element classes.""" +const t8_eclass_t = t8_eclass + """ sc_tag_t @@ -342,7 +379,7 @@ int sc_MPI_Testall (int, sc_MPI_Request *, int *, sc_MPI_Status *); ``` """ function sc_MPI_Testall(arg1, arg2, arg3, arg4) - @ccall libsc.sc_MPI_Testall(arg1::Cint, arg2::Ptr{Cint}, arg3::Ptr{Cint}, arg4::Ptr{Cint})::Cint + @ccall libt8.sc_MPI_Testall(arg1::Cint, arg2::Ptr{Cint}, arg3::Ptr{Cint}, arg4::Ptr{Cint})::Cint end """ @@ -361,7 +398,7 @@ int sc_MPI_Error_class (int errorcode, int *errorclass); ``` """ function sc_MPI_Error_class(errorcode, errorclass) - @ccall libsc.sc_MPI_Error_class(errorcode::Cint, errorclass::Ptr{Cint})::Cint + @ccall libt8.sc_MPI_Error_class(errorcode::Cint, errorclass::Ptr{Cint})::Cint end """ @@ -381,7 +418,7 @@ int sc_MPI_Error_string (int errorcode, char *string, int *resultlen); ``` """ function sc_MPI_Error_string(errorcode, string, resultlen) - @ccall libsc.sc_MPI_Error_string(errorcode::Cint, string::Cstring, resultlen::Ptr{Cint})::Cint + @ccall libt8.sc_MPI_Error_string(errorcode::Cint, string::Cstring, resultlen::Ptr{Cint})::Cint end """ @@ -393,7 +430,7 @@ size_t sc_mpi_sizeof (sc_MPI_Datatype t); ``` """ function sc_mpi_sizeof(t) - @ccall libsc.sc_mpi_sizeof(t::MPI_Datatype)::Csize_t + @ccall libt8.sc_mpi_sizeof(t::Cint)::Csize_t end """ @@ -405,7 +442,7 @@ void sc_mpi_comm_attach_node_comms (sc_MPI_Comm comm, int processes_per_node); ``` """ function sc_mpi_comm_attach_node_comms(comm, processes_per_node) - @ccall libsc.sc_mpi_comm_attach_node_comms(comm::MPI_Comm, processes_per_node::Cint)::Cvoid + @ccall libt8.sc_mpi_comm_attach_node_comms(comm::Cint, processes_per_node::Cint)::Cvoid end """ @@ -417,7 +454,7 @@ void sc_mpi_comm_detach_node_comms (sc_MPI_Comm comm); ``` """ function sc_mpi_comm_detach_node_comms(comm) - @ccall libsc.sc_mpi_comm_detach_node_comms(comm::MPI_Comm)::Cvoid + @ccall libt8.sc_mpi_comm_detach_node_comms(comm::Cint)::Cvoid end """ @@ -429,7 +466,7 @@ void sc_mpi_comm_get_node_comms (sc_MPI_Comm comm, sc_MPI_Comm * intranode, sc_M ``` """ function sc_mpi_comm_get_node_comms(comm, intranode, internode) - @ccall libsc.sc_mpi_comm_get_node_comms(comm::MPI_Comm, intranode::Ptr{MPI_Comm}, internode::Ptr{MPI_Comm})::Cvoid + @ccall libt8.sc_mpi_comm_get_node_comms(comm::Cint, intranode::Ptr{Cint}, internode::Ptr{Cint})::Cvoid end """ @@ -441,7 +478,7 @@ int sc_mpi_comm_get_and_attach (sc_MPI_Comm comm); ``` """ function sc_mpi_comm_get_and_attach(comm) - @ccall libsc.sc_mpi_comm_get_and_attach(comm::MPI_Comm)::Cint + @ccall libt8.sc_mpi_comm_get_and_attach(comm::Cint)::Cint end # typedef void ( * sc_handler_t ) ( void * data ) @@ -463,7 +500,7 @@ int sc_memory_status (int package); ``` """ function sc_memory_status(package) - @ccall libsc.sc_memory_status(package::Cint)::Cint + @ccall libt8.sc_memory_status(package::Cint)::Cint end """ @@ -475,7 +512,7 @@ void sc_memory_check (int package); ``` """ function sc_memory_check(package) - @ccall libsc.sc_memory_check(package::Cint)::Cvoid + @ccall libt8.sc_memory_check(package::Cint)::Cvoid end """ @@ -489,7 +526,7 @@ int sc_memory_check_noerr (int package); ``` """ function sc_memory_check_noerr(package) - @ccall libsc.sc_memory_check_noerr(package::Cint)::Cint + @ccall libt8.sc_memory_check_noerr(package::Cint)::Cint end """ @@ -501,7 +538,7 @@ int sc_int_compare (const void *v1, const void *v2); ``` """ function sc_int_compare(v1, v2) - @ccall libsc.sc_int_compare(v1::Ptr{Cvoid}, v2::Ptr{Cvoid})::Cint + @ccall libt8.sc_int_compare(v1::Ptr{Cvoid}, v2::Ptr{Cvoid})::Cint end """ @@ -513,7 +550,7 @@ int sc_int8_compare (const void *v1, const void *v2); ``` """ function sc_int8_compare(v1, v2) - @ccall libsc.sc_int8_compare(v1::Ptr{Cvoid}, v2::Ptr{Cvoid})::Cint + @ccall libt8.sc_int8_compare(v1::Ptr{Cvoid}, v2::Ptr{Cvoid})::Cint end """ @@ -525,7 +562,7 @@ int sc_int16_compare (const void *v1, const void *v2); ``` """ function sc_int16_compare(v1, v2) - @ccall libsc.sc_int16_compare(v1::Ptr{Cvoid}, v2::Ptr{Cvoid})::Cint + @ccall libt8.sc_int16_compare(v1::Ptr{Cvoid}, v2::Ptr{Cvoid})::Cint end """ @@ -537,7 +574,7 @@ int sc_double_compare (const void *v1, const void *v2); ``` """ function sc_double_compare(v1, v2) - @ccall libsc.sc_double_compare(v1::Ptr{Cvoid}, v2::Ptr{Cvoid})::Cint + @ccall libt8.sc_double_compare(v1::Ptr{Cvoid}, v2::Ptr{Cvoid})::Cint end """ @@ -555,7 +592,7 @@ int sc_atoi (const char *nptr); ``` """ function sc_atoi(nptr) - @ccall libsc.sc_atoi(nptr::Cstring)::Cint + @ccall libt8.sc_atoi(nptr::Cstring)::Cint end """ @@ -573,7 +610,7 @@ long sc_atol (const char *nptr); ``` """ function sc_atol(nptr) - @ccall libsc.sc_atol(nptr::Cstring)::Clong + @ccall libt8.sc_atol(nptr::Cstring)::Clong end """ @@ -582,16 +619,16 @@ end Controls the default SC log behavior. # Arguments -* `log_stream`:\\[in\\] Set stream to use by `sc_logf` (or NULL for stdout). +* `log_stream`:\\[in\\] Set stream to use by [`sc_logf`](@ref) (or NULL for stdout). * `log_handler`:\\[in\\] Set default SC log handler (NULL selects builtin). -* `log_threshold`:\\[in\\] Set default SC log threshold (or `SC_LP_DEFAULT`). May be `SC_LP_ALWAYS` or `SC_LP_SILENT`. +* `log_threshold`:\\[in\\] Set default SC log threshold (or [`SC_LP_DEFAULT`](@ref)). May be [`SC_LP_ALWAYS`](@ref) or [`SC_LP_SILENT`](@ref). ### Prototype ```c void sc_set_log_defaults (FILE * log_stream, sc_log_handler_t log_handler, int log_threshold); ``` """ function sc_set_log_defaults(log_stream, log_handler, log_threshold) - @ccall libsc.sc_set_log_defaults(log_stream::Ptr{Libc.FILE}, log_handler::sc_log_handler_t, log_threshold::Cint)::Cvoid + @ccall libt8.sc_set_log_defaults(log_stream::Ptr{Libc.FILE}, log_handler::sc_log_handler_t, log_threshold::Cint)::Cvoid end """ @@ -607,7 +644,7 @@ void sc_set_abort_handler (sc_abort_handler_t abort_handler); ``` """ function sc_set_abort_handler(abort_handler) - @ccall libsc.sc_set_abort_handler(abort_handler::sc_abort_handler_t)::Cvoid + @ccall libt8.sc_set_abort_handler(abort_handler::sc_abort_handler_t)::Cvoid end """ @@ -621,7 +658,7 @@ void sc_log_indent_push_count (int package, int count); ``` """ function sc_log_indent_push_count(package, count) - @ccall libsc.sc_log_indent_push_count(package::Cint, count::Cint)::Cvoid + @ccall libt8.sc_log_indent_push_count(package::Cint, count::Cint)::Cvoid end """ @@ -635,7 +672,7 @@ void sc_log_indent_pop_count (int package, int count); ``` """ function sc_log_indent_pop_count(package, count) - @ccall libsc.sc_log_indent_pop_count(package::Cint, count::Cint)::Cvoid + @ccall libt8.sc_log_indent_pop_count(package::Cint, count::Cint)::Cvoid end """ @@ -649,7 +686,7 @@ void sc_log_indent_push (void); ``` """ function sc_log_indent_push() - @ccall libsc.sc_log_indent_push()::Cvoid + @ccall libt8.sc_log_indent_push()::Cvoid end """ @@ -663,7 +700,7 @@ void sc_log_indent_pop (void); ``` """ function sc_log_indent_pop() - @ccall libsc.sc_log_indent_pop()::Cvoid + @ccall libt8.sc_log_indent_pop()::Cvoid end """ @@ -677,7 +714,7 @@ void sc_abort (void) __attribute__ ((noreturn)); ``` """ function sc_abort() - @ccall libsc.sc_abort()::Cvoid + @ccall libt8.sc_abort()::Cvoid end """ @@ -691,7 +728,7 @@ void sc_abort_collective (const char *msg) __attribute__ ((noreturn)); ``` """ function sc_abort_collective(msg) - @ccall libsc.sc_abort_collective(msg::Cstring)::Cvoid + @ccall libt8.sc_abort_collective(msg::Cstring)::Cvoid end """ @@ -707,7 +744,7 @@ int sc_package_register (sc_log_handler_t log_handler, int log_threshold, const ``` """ function sc_package_register(log_handler, log_threshold, name, full) - @ccall libsc.sc_package_register(log_handler::sc_log_handler_t, log_threshold::Cint, name::Cstring, full::Cstring)::Cint + @ccall libt8.sc_package_register(log_handler::sc_log_handler_t, log_threshold::Cint, name::Cstring, full::Cstring)::Cint end """ @@ -725,7 +762,7 @@ int sc_package_is_registered (int package_id); ``` """ function sc_package_is_registered(package_id) - @ccall libsc.sc_package_is_registered(package_id::Cint)::Cint + @ccall libt8.sc_package_is_registered(package_id::Cint)::Cint end """ @@ -741,7 +778,7 @@ void sc_package_lock (int package_id); ``` """ function sc_package_lock(package_id) - @ccall libsc.sc_package_lock(package_id::Cint)::Cvoid + @ccall libt8.sc_package_lock(package_id::Cint)::Cvoid end """ @@ -757,13 +794,13 @@ void sc_package_unlock (int package_id); ``` """ function sc_package_unlock(package_id) - @ccall libsc.sc_package_unlock(package_id::Cint)::Cvoid + @ccall libt8.sc_package_unlock(package_id::Cint)::Cvoid end """ sc_package_set_verbosity(package_id, log_priority) -Set the logging verbosity of a registered package. This can be called at any point in the program, any number of times. It can only lower the verbosity at and below the value of `SC_LP_THRESHOLD`. +Set the logging verbosity of a registered package. This can be called at any point in the program, any number of times. It can only lower the verbosity at and below the value of [`SC_LP_THRESHOLD`](@ref). # Arguments * `package_id`:\\[in\\] Must be a registered package identifier. @@ -773,7 +810,7 @@ void sc_package_set_verbosity (int package_id, int log_priority); ``` """ function sc_package_set_verbosity(package_id, log_priority) - @ccall libsc.sc_package_set_verbosity(package_id::Cint, log_priority::Cint)::Cvoid + @ccall libt8.sc_package_set_verbosity(package_id::Cint, log_priority::Cint)::Cvoid end """ @@ -790,7 +827,7 @@ void sc_package_set_abort_alloc_mismatch (int package_id, int set_abort); ``` """ function sc_package_set_abort_alloc_mismatch(package_id, set_abort) - @ccall libsc.sc_package_set_abort_alloc_mismatch(package_id::Cint, set_abort::Cint)::Cvoid + @ccall libt8.sc_package_set_abort_alloc_mismatch(package_id::Cint, set_abort::Cint)::Cvoid end """ @@ -804,13 +841,13 @@ void sc_package_unregister (int package_id); ``` """ function sc_package_unregister(package_id) - @ccall libsc.sc_package_unregister(package_id::Cint)::Cvoid + @ccall libt8.sc_package_unregister(package_id::Cint)::Cvoid end """ sc_package_print_summary(log_priority) -Print a summary of all packages registered with SC. Uses the `SC_LC_GLOBAL` log category which by default only prints on rank 0. +Print a summary of all packages registered with SC. Uses the [`SC_LC_GLOBAL`](@ref) log category which by default only prints on rank 0. # Arguments * `log_priority`:\\[in\\] Priority passed to sc log functions. @@ -820,7 +857,7 @@ void sc_package_print_summary (int log_priority); ``` """ function sc_package_print_summary(log_priority) - @ccall libsc.sc_package_print_summary(log_priority::Cint)::Cvoid + @ccall libt8.sc_package_print_summary(log_priority::Cint)::Cvoid end """ @@ -832,7 +869,7 @@ void sc_init (sc_MPI_Comm mpicomm, int catch_signals, int print_backtrace, sc_lo ``` """ function sc_init(mpicomm, catch_signals, print_backtrace, log_handler, log_threshold) - @ccall libsc.sc_init(mpicomm::MPI_Comm, catch_signals::Cint, print_backtrace::Cint, log_handler::sc_log_handler_t, log_threshold::Cint)::Cvoid + @ccall libt8.sc_init(mpicomm::Cint, catch_signals::Cint, print_backtrace::Cint, log_handler::sc_log_handler_t, log_threshold::Cint)::Cvoid end """ @@ -852,7 +889,7 @@ int sc_is_initialized (void); ``` """ function sc_is_initialized() - @ccall libsc.sc_is_initialized()::Cint + @ccall libt8.sc_is_initialized()::Cint end """ @@ -872,7 +909,7 @@ int sc_get_package_id (void); ``` """ function sc_get_package_id() - @ccall libsc.sc_get_package_id()::Cint + @ccall libt8.sc_get_package_id()::Cint end """ @@ -886,7 +923,7 @@ void sc_finalize (void); ``` """ function sc_finalize() - @ccall libsc.sc_finalize()::Cvoid + @ccall libt8.sc_finalize()::Cvoid end """ @@ -902,13 +939,13 @@ int sc_finalize_noabort (void); ``` """ function sc_finalize_noabort() - @ccall libsc.sc_finalize_noabort()::Cint + @ccall libt8.sc_finalize_noabort()::Cint end """ sc_is_root() -Identify the root process. Only meaningful between [`sc_init`](@ref) and [`sc_finalize`](@ref) and with a communicator that is not `sc_MPI_COMM_NULL` (otherwise always true). +Identify the root process. Only meaningful between [`sc_init`](@ref) and [`sc_finalize`](@ref) and with a communicator that is not [`sc_MPI_COMM_NULL`](@ref) (otherwise always true). # Returns Return true for the root process and false otherwise. @@ -918,7 +955,7 @@ int sc_is_root (void); ``` """ function sc_is_root() - @ccall libsc.sc_is_root()::Cint + @ccall libt8.sc_is_root()::Cint end """ @@ -938,12 +975,12 @@ void sc_strcopy (char *dest, size_t size, const char *src); ``` """ function sc_strcopy(dest, size, src) - @ccall libsc.sc_strcopy(dest::Cstring, size::Csize_t, src::Cstring)::Cvoid + @ccall libt8.sc_strcopy(dest::Cstring, size::Csize_t, src::Cstring)::Cvoid end # automatic type deduction for variadic arguments may not be what you want, please use with caution @generated function sc_snprintf(str, size, format, va_list...) - :(@ccall(libsc.sc_snprintf(str::Cstring, size::Csize_t, format::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + :(@ccall(libt8.sc_snprintf(str::Cstring, size::Csize_t, format::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) end """ @@ -959,7 +996,7 @@ const char *sc_version (void); ``` """ function sc_version() - @ccall libsc.sc_version()::Cstring + @ccall libt8.sc_version()::Cstring end """ @@ -975,7 +1012,7 @@ int sc_version_major (void); ``` """ function sc_version_major() - @ccall libsc.sc_version_major()::Cint + @ccall libt8.sc_version_major()::Cint end """ @@ -991,7 +1028,7 @@ int sc_version_minor (void); ``` """ function sc_version_minor() - @ccall libsc.sc_version_minor()::Cint + @ccall libt8.sc_version_minor()::Cint end """ @@ -1007,7 +1044,7 @@ int sc_have_zlib (void); ``` """ function sc_have_zlib() - @ccall libsc.sc_have_zlib()::Cint + @ccall libt8.sc_have_zlib()::Cint end """ @@ -1023,7 +1060,7 @@ int sc_have_json (void); ``` """ function sc_have_json() - @ccall libsc.sc_have_json()::Cint + @ccall libt8.sc_have_json()::Cint end # typedef unsigned int ( * sc_hash_function_t ) ( const void * v , const void * u ) @@ -1079,7 +1116,7 @@ size_t sc_array_memory_used (sc_array_t * array, int is_dynamic); ``` """ function sc_array_memory_used(array, is_dynamic) - @ccall libsc.sc_array_memory_used(array::Ptr{sc_array_t}, is_dynamic::Cint)::Csize_t + @ccall libt8.sc_array_memory_used(array::Ptr{sc_array_t}, is_dynamic::Cint)::Csize_t end """ @@ -1097,7 +1134,7 @@ sc_array_t *sc_array_new (size_t elem_size); ``` """ function sc_array_new(elem_size) - @ccall libsc.sc_array_new(elem_size::Csize_t)::Ptr{sc_array_t} + @ccall libt8.sc_array_new(elem_size::Csize_t)::Ptr{sc_array_t} end """ @@ -1115,7 +1152,7 @@ sc_array_t *sc_array_new_view (sc_array_t * array, size_t offset, size_t length) ``` """ function sc_array_new_view(array, offset, length) - @ccall libsc.sc_array_new_view(array::Ptr{sc_array_t}, offset::Csize_t, length::Csize_t)::Ptr{sc_array_t} + @ccall libt8.sc_array_new_view(array::Ptr{sc_array_t}, offset::Csize_t, length::Csize_t)::Ptr{sc_array_t} end """ @@ -1133,7 +1170,7 @@ sc_array_t *sc_array_new_data (void *base, size_t elem_size, size_t elem_count); ``` """ function sc_array_new_data(base, elem_size, elem_count) - @ccall libsc.sc_array_new_data(base::Ptr{Cvoid}, elem_size::Csize_t, elem_count::Csize_t)::Ptr{sc_array_t} + @ccall libt8.sc_array_new_data(base::Ptr{Cvoid}, elem_size::Csize_t, elem_count::Csize_t)::Ptr{sc_array_t} end """ @@ -1149,7 +1186,7 @@ void sc_array_destroy (sc_array_t * array); ``` """ function sc_array_destroy(array) - @ccall libsc.sc_array_destroy(array::Ptr{sc_array_t})::Cvoid + @ccall libt8.sc_array_destroy(array::Ptr{sc_array_t})::Cvoid end """ @@ -1165,7 +1202,7 @@ void sc_array_destroy_null (sc_array_t ** parray); ``` """ function sc_array_destroy_null(parray) - @ccall libsc.sc_array_destroy_null(parray::Ptr{Ptr{sc_array_t}})::Cvoid + @ccall libt8.sc_array_destroy_null(parray::Ptr{Ptr{sc_array_t}})::Cvoid end """ @@ -1182,7 +1219,7 @@ void sc_array_init (sc_array_t * array, size_t elem_size); ``` """ function sc_array_init(array, elem_size) - @ccall libsc.sc_array_init(array::Ptr{sc_array_t}, elem_size::Csize_t)::Cvoid + @ccall libt8.sc_array_init(array::Ptr{sc_array_t}, elem_size::Csize_t)::Cvoid end """ @@ -1200,7 +1237,7 @@ void sc_array_init_size (sc_array_t * array, size_t elem_size, size_t elem_count ``` """ function sc_array_init_size(array, elem_size, elem_count) - @ccall libsc.sc_array_init_size(array::Ptr{sc_array_t}, elem_size::Csize_t, elem_count::Csize_t)::Cvoid + @ccall libt8.sc_array_init_size(array::Ptr{sc_array_t}, elem_size::Csize_t, elem_count::Csize_t)::Cvoid end """ @@ -1218,7 +1255,7 @@ void sc_array_init_count (sc_array_t * array, size_t elem_size, size_t elem_coun ``` """ function sc_array_init_count(array, elem_size, elem_count) - @ccall libsc.sc_array_init_count(array::Ptr{sc_array_t}, elem_size::Csize_t, elem_count::Csize_t)::Cvoid + @ccall libt8.sc_array_init_count(array::Ptr{sc_array_t}, elem_size::Csize_t, elem_count::Csize_t)::Cvoid end """ @@ -1237,7 +1274,7 @@ void sc_array_init_view (sc_array_t * view, sc_array_t * array, size_t offset, s ``` """ function sc_array_init_view(view, array, offset, length) - @ccall libsc.sc_array_init_view(view::Ptr{sc_array_t}, array::Ptr{sc_array_t}, offset::Csize_t, length::Csize_t)::Cvoid + @ccall libt8.sc_array_init_view(view::Ptr{sc_array_t}, array::Ptr{sc_array_t}, offset::Csize_t, length::Csize_t)::Cvoid end """ @@ -1256,7 +1293,7 @@ void sc_array_init_reshape (sc_array_t * view, sc_array_t * array, size_t elem_s ``` """ function sc_array_init_reshape(view, array, elem_size, elem_count) - @ccall libsc.sc_array_init_reshape(view::Ptr{sc_array_t}, array::Ptr{sc_array_t}, elem_size::Csize_t, elem_count::Csize_t)::Cvoid + @ccall libt8.sc_array_init_reshape(view::Ptr{sc_array_t}, array::Ptr{sc_array_t}, elem_size::Csize_t, elem_count::Csize_t)::Cvoid end """ @@ -1275,7 +1312,7 @@ void sc_array_init_data (sc_array_t * view, void *base, size_t elem_size, size_t ``` """ function sc_array_init_data(view, base, elem_size, elem_count) - @ccall libsc.sc_array_init_data(view::Ptr{sc_array_t}, base::Ptr{Cvoid}, elem_size::Csize_t, elem_count::Csize_t)::Cvoid + @ccall libt8.sc_array_init_data(view::Ptr{sc_array_t}, base::Ptr{Cvoid}, elem_size::Csize_t, elem_count::Csize_t)::Cvoid end """ @@ -1292,7 +1329,7 @@ void sc_array_memset (sc_array_t * array, int c); ``` """ function sc_array_memset(array, c) - @ccall libsc.sc_array_memset(array::Ptr{sc_array_t}, c::Cint)::Cvoid + @ccall libt8.sc_array_memset(array::Ptr{sc_array_t}, c::Cint)::Cvoid end """ @@ -1312,7 +1349,7 @@ void sc_array_reset (sc_array_t * array); ``` """ function sc_array_reset(array) - @ccall libsc.sc_array_reset(array::Ptr{sc_array_t})::Cvoid + @ccall libt8.sc_array_reset(array::Ptr{sc_array_t})::Cvoid end """ @@ -1332,7 +1369,7 @@ void sc_array_truncate (sc_array_t * array); ``` """ function sc_array_truncate(array) - @ccall libsc.sc_array_truncate(array::Ptr{sc_array_t})::Cvoid + @ccall libt8.sc_array_truncate(array::Ptr{sc_array_t})::Cvoid end """ @@ -1349,7 +1386,7 @@ void sc_array_rewind (sc_array_t * array, size_t new_count); ``` """ function sc_array_rewind(array, new_count) - @ccall libsc.sc_array_rewind(array::Ptr{sc_array_t}, new_count::Csize_t)::Cvoid + @ccall libt8.sc_array_rewind(array::Ptr{sc_array_t}, new_count::Csize_t)::Cvoid end """ @@ -1366,7 +1403,7 @@ void sc_array_resize (sc_array_t * array, size_t new_count); ``` """ function sc_array_resize(array, new_count) - @ccall libsc.sc_array_resize(array::Ptr{sc_array_t}, new_count::Csize_t)::Cvoid + @ccall libt8.sc_array_resize(array::Ptr{sc_array_t}, new_count::Csize_t)::Cvoid end """ @@ -1383,7 +1420,7 @@ void sc_array_copy (sc_array_t * dest, sc_array_t * src); ``` """ function sc_array_copy(dest, src) - @ccall libsc.sc_array_copy(dest::Ptr{sc_array_t}, src::Ptr{sc_array_t})::Cvoid + @ccall libt8.sc_array_copy(dest::Ptr{sc_array_t}, src::Ptr{sc_array_t})::Cvoid end """ @@ -1401,7 +1438,7 @@ void sc_array_copy_into (sc_array_t * dest, size_t dest_offset, sc_array_t * src ``` """ function sc_array_copy_into(dest, dest_offset, src) - @ccall libsc.sc_array_copy_into(dest::Ptr{sc_array_t}, dest_offset::Csize_t, src::Ptr{sc_array_t})::Cvoid + @ccall libt8.sc_array_copy_into(dest::Ptr{sc_array_t}, dest_offset::Csize_t, src::Ptr{sc_array_t})::Cvoid end """ @@ -1421,7 +1458,7 @@ void sc_array_move_part (sc_array_t * dest, size_t dest_offset, sc_array_t * src ``` """ function sc_array_move_part(dest, dest_offset, src, src_offset, count) - @ccall libsc.sc_array_move_part(dest::Ptr{sc_array_t}, dest_offset::Csize_t, src::Ptr{sc_array_t}, src_offset::Csize_t, count::Csize_t)::Cvoid + @ccall libt8.sc_array_move_part(dest::Ptr{sc_array_t}, dest_offset::Csize_t, src::Ptr{sc_array_t}, src_offset::Csize_t, count::Csize_t)::Cvoid end """ @@ -1438,7 +1475,7 @@ void sc_array_sort (sc_array_t * array, int (*compar) (const void *, const void ``` """ function sc_array_sort(array, compar) - @ccall libsc.sc_array_sort(array::Ptr{sc_array_t}, compar::Ptr{Cvoid})::Cvoid + @ccall libt8.sc_array_sort(array::Ptr{sc_array_t}, compar::Ptr{Cvoid})::Cvoid end """ @@ -1457,7 +1494,7 @@ int sc_array_is_sorted (sc_array_t * array, int (*compar) (const void *, const v ``` """ function sc_array_is_sorted(array, compar) - @ccall libsc.sc_array_is_sorted(array::Ptr{sc_array_t}, compar::Ptr{Cvoid})::Cint + @ccall libt8.sc_array_is_sorted(array::Ptr{sc_array_t}, compar::Ptr{Cvoid})::Cint end """ @@ -1476,7 +1513,7 @@ int sc_array_is_equal (sc_array_t * array, sc_array_t * other); ``` """ function sc_array_is_equal(array, other) - @ccall libsc.sc_array_is_equal(array::Ptr{sc_array_t}, other::Ptr{sc_array_t})::Cint + @ccall libt8.sc_array_is_equal(array::Ptr{sc_array_t}, other::Ptr{sc_array_t})::Cint end """ @@ -1493,7 +1530,7 @@ void sc_array_uniq (sc_array_t * array, int (*compar) (const void *, const void ``` """ function sc_array_uniq(array, compar) - @ccall libsc.sc_array_uniq(array::Ptr{sc_array_t}, compar::Ptr{Cvoid})::Cvoid + @ccall libt8.sc_array_uniq(array::Ptr{sc_array_t}, compar::Ptr{Cvoid})::Cvoid end """ @@ -1513,7 +1550,7 @@ ssize_t sc_array_bsearch (sc_array_t * array, const void *key, int (*compar) (co ``` """ function sc_array_bsearch(array, key, compar) - @ccall libsc.sc_array_bsearch(array::Ptr{sc_array_t}, key::Ptr{Cvoid}, compar::Ptr{Cvoid})::Cssize_t + @ccall libt8.sc_array_bsearch(array::Ptr{sc_array_t}, key::Ptr{Cvoid}, compar::Ptr{Cvoid})::Cssize_t end # typedef size_t ( * sc_array_type_t ) ( sc_array_t * array , size_t index , void * data ) @@ -1544,7 +1581,7 @@ void sc_array_split (sc_array_t * array, sc_array_t * offsets, size_t num_types, ``` """ function sc_array_split(array, offsets, num_types, type_fn, data) - @ccall libsc.sc_array_split(array::Ptr{sc_array_t}, offsets::Ptr{sc_array_t}, num_types::Csize_t, type_fn::sc_array_type_t, data::Ptr{Cvoid})::Cvoid + @ccall libt8.sc_array_split(array::Ptr{sc_array_t}, offsets::Ptr{sc_array_t}, num_types::Csize_t, type_fn::sc_array_type_t, data::Ptr{Cvoid})::Cvoid end """ @@ -1562,7 +1599,7 @@ int sc_array_is_permutation (sc_array_t * array); ``` """ function sc_array_is_permutation(array) - @ccall libsc.sc_array_is_permutation(array::Ptr{sc_array_t})::Cint + @ccall libt8.sc_array_is_permutation(array::Ptr{sc_array_t})::Cint end """ @@ -1580,7 +1617,7 @@ void sc_array_permute (sc_array_t * array, sc_array_t * newindices, int keepperm ``` """ function sc_array_permute(array, newindices, keepperm) - @ccall libsc.sc_array_permute(array::Ptr{sc_array_t}, newindices::Ptr{sc_array_t}, keepperm::Cint)::Cvoid + @ccall libt8.sc_array_permute(array::Ptr{sc_array_t}, newindices::Ptr{sc_array_t}, keepperm::Cint)::Cvoid end """ @@ -1594,7 +1631,7 @@ unsigned int sc_array_checksum (sc_array_t * array); ``` """ function sc_array_checksum(array) - @ccall libsc.sc_array_checksum(array::Ptr{sc_array_t})::Cuint + @ccall libt8.sc_array_checksum(array::Ptr{sc_array_t})::Cuint end """ @@ -1622,7 +1659,7 @@ size_t sc_array_pqueue_add (sc_array_t * array, void *temp, int (*compar) (const ``` """ function sc_array_pqueue_add(array, temp, compar) - @ccall libsc.sc_array_pqueue_add(array::Ptr{sc_array_t}, temp::Ptr{Cvoid}, compar::Ptr{Cvoid})::Csize_t + @ccall libt8.sc_array_pqueue_add(array::Ptr{sc_array_t}, temp::Ptr{Cvoid}, compar::Ptr{Cvoid})::Csize_t end """ @@ -1650,7 +1687,7 @@ size_t sc_array_pqueue_pop (sc_array_t * array, void *result, int (*compar) (con ``` """ function sc_array_pqueue_pop(array, result, compar) - @ccall libsc.sc_array_pqueue_pop(array::Ptr{sc_array_t}, result::Ptr{Cvoid}, compar::Ptr{Cvoid})::Csize_t + @ccall libt8.sc_array_pqueue_pop(array::Ptr{sc_array_t}, result::Ptr{Cvoid}, compar::Ptr{Cvoid})::Csize_t end """ @@ -1662,7 +1699,7 @@ static inline void * sc_array_index (sc_array_t * array, size_t iz); ``` """ function sc_array_index(array, iz) - @ccall libsc.sc_array_index(array::Ptr{sc_array_t}, iz::Csize_t)::Ptr{Cvoid} + @ccall libt8.sc_array_index(array::Ptr{sc_array_t}, iz::Csize_t)::Ptr{Cvoid} end """ @@ -1674,7 +1711,7 @@ static inline void * sc_array_index_null (sc_array_t * array, size_t iz); ``` """ function sc_array_index_null(array, iz) - @ccall libsc.sc_array_index_null(array::Ptr{sc_array_t}, iz::Csize_t)::Ptr{Cvoid} + @ccall libt8.sc_array_index_null(array::Ptr{sc_array_t}, iz::Csize_t)::Ptr{Cvoid} end """ @@ -1686,7 +1723,7 @@ static inline void * sc_array_index_int (sc_array_t * array, int i); ``` """ function sc_array_index_int(array, i) - @ccall libsc.sc_array_index_int(array::Ptr{sc_array_t}, i::Cint)::Ptr{Cvoid} + @ccall libt8.sc_array_index_int(array::Ptr{sc_array_t}, i::Cint)::Ptr{Cvoid} end """ @@ -1698,7 +1735,7 @@ static inline void * sc_array_index_long (sc_array_t * array, long l); ``` """ function sc_array_index_long(array, l) - @ccall libsc.sc_array_index_long(array::Ptr{sc_array_t}, l::Clong)::Ptr{Cvoid} + @ccall libt8.sc_array_index_long(array::Ptr{sc_array_t}, l::Clong)::Ptr{Cvoid} end """ @@ -1710,7 +1747,7 @@ static inline void * sc_array_index_ssize_t (sc_array_t * array, ssize_t is); ``` """ function sc_array_index_ssize_t(array, is) - @ccall libsc.sc_array_index_ssize_t(array::Ptr{sc_array_t}, is::Cssize_t)::Ptr{Cvoid} + @ccall libt8.sc_array_index_ssize_t(array::Ptr{sc_array_t}, is::Cssize_t)::Ptr{Cvoid} end """ @@ -1722,7 +1759,7 @@ static inline void * sc_array_index_int16 (sc_array_t * array, int16_t i16); ``` """ function sc_array_index_int16(array, i16) - @ccall libsc.sc_array_index_int16(array::Ptr{sc_array_t}, i16::Int16)::Ptr{Cvoid} + @ccall libt8.sc_array_index_int16(array::Ptr{sc_array_t}, i16::Int16)::Ptr{Cvoid} end """ @@ -1734,7 +1771,7 @@ static inline size_t sc_array_position (sc_array_t * array, void *element); ``` """ function sc_array_position(array, element) - @ccall libsc.sc_array_position(array::Ptr{sc_array_t}, element::Ptr{Cvoid})::Csize_t + @ccall libt8.sc_array_position(array::Ptr{sc_array_t}, element::Ptr{Cvoid})::Csize_t end """ @@ -1746,7 +1783,7 @@ static inline void * sc_array_pop (sc_array_t * array); ``` """ function sc_array_pop(array) - @ccall libsc.sc_array_pop(array::Ptr{sc_array_t})::Ptr{Cvoid} + @ccall libt8.sc_array_pop(array::Ptr{sc_array_t})::Ptr{Cvoid} end """ @@ -1758,7 +1795,7 @@ static inline void * sc_array_push_count (sc_array_t * array, size_t add_count); ``` """ function sc_array_push_count(array, add_count) - @ccall libsc.sc_array_push_count(array::Ptr{sc_array_t}, add_count::Csize_t)::Ptr{Cvoid} + @ccall libt8.sc_array_push_count(array::Ptr{sc_array_t}, add_count::Csize_t)::Ptr{Cvoid} end """ @@ -1770,7 +1807,7 @@ static inline void * sc_array_push (sc_array_t * array); ``` """ function sc_array_push(array) - @ccall libsc.sc_array_push(array::Ptr{sc_array_t})::Ptr{Cvoid} + @ccall libt8.sc_array_push(array::Ptr{sc_array_t})::Ptr{Cvoid} end """ @@ -1814,7 +1851,7 @@ void sc_mstamp_init (sc_mstamp_t * mst, size_t stamp_unit, size_t elem_size); ``` """ function sc_mstamp_init(mst, stamp_unit, elem_size) - @ccall libsc.sc_mstamp_init(mst::Ptr{sc_mstamp_t}, stamp_unit::Csize_t, elem_size::Csize_t)::Cvoid + @ccall libt8.sc_mstamp_init(mst::Ptr{sc_mstamp_t}, stamp_unit::Csize_t, elem_size::Csize_t)::Cvoid end """ @@ -1830,7 +1867,7 @@ void sc_mstamp_reset (sc_mstamp_t * mst); ``` """ function sc_mstamp_reset(mst) - @ccall libsc.sc_mstamp_reset(mst::Ptr{sc_mstamp_t})::Cvoid + @ccall libt8.sc_mstamp_reset(mst::Ptr{sc_mstamp_t})::Cvoid end """ @@ -1846,7 +1883,7 @@ void sc_mstamp_truncate (sc_mstamp_t * mst); ``` """ function sc_mstamp_truncate(mst) - @ccall libsc.sc_mstamp_truncate(mst::Ptr{sc_mstamp_t})::Cvoid + @ccall libt8.sc_mstamp_truncate(mst::Ptr{sc_mstamp_t})::Cvoid end """ @@ -1864,7 +1901,7 @@ void *sc_mstamp_alloc (sc_mstamp_t * mst); ``` """ function sc_mstamp_alloc(mst) - @ccall libsc.sc_mstamp_alloc(mst::Ptr{sc_mstamp_t})::Ptr{Cvoid} + @ccall libt8.sc_mstamp_alloc(mst::Ptr{sc_mstamp_t})::Ptr{Cvoid} end """ @@ -1882,7 +1919,7 @@ size_t sc_mstamp_memory_used (sc_mstamp_t * mst); ``` """ function sc_mstamp_memory_used(mst) - @ccall libsc.sc_mstamp_memory_used(mst::Ptr{sc_mstamp_t})::Csize_t + @ccall libt8.sc_mstamp_memory_used(mst::Ptr{sc_mstamp_t})::Csize_t end """ @@ -1924,7 +1961,7 @@ size_t sc_mempool_memory_used (sc_mempool_t * mempool); ``` """ function sc_mempool_memory_used(mempool) - @ccall libsc.sc_mempool_memory_used(mempool::Ptr{sc_mempool_t})::Csize_t + @ccall libt8.sc_mempool_memory_used(mempool::Ptr{sc_mempool_t})::Csize_t end """ @@ -1942,7 +1979,7 @@ sc_mempool_t *sc_mempool_new (size_t elem_size); ``` """ function sc_mempool_new(elem_size) - @ccall libsc.sc_mempool_new(elem_size::Csize_t)::Ptr{sc_mempool_t} + @ccall libt8.sc_mempool_new(elem_size::Csize_t)::Ptr{sc_mempool_t} end """ @@ -1960,7 +1997,7 @@ sc_mempool_t *sc_mempool_new_zero_and_persist (size_t elem_size); ``` """ function sc_mempool_new_zero_and_persist(elem_size) - @ccall libsc.sc_mempool_new_zero_and_persist(elem_size::Csize_t)::Ptr{sc_mempool_t} + @ccall libt8.sc_mempool_new_zero_and_persist(elem_size::Csize_t)::Ptr{sc_mempool_t} end """ @@ -1977,7 +2014,7 @@ void sc_mempool_init (sc_mempool_t * mempool, size_t elem_size); ``` """ function sc_mempool_init(mempool, elem_size) - @ccall libsc.sc_mempool_init(mempool::Ptr{sc_mempool_t}, elem_size::Csize_t)::Cvoid + @ccall libt8.sc_mempool_init(mempool::Ptr{sc_mempool_t}, elem_size::Csize_t)::Cvoid end """ @@ -1993,7 +2030,7 @@ void sc_mempool_destroy (sc_mempool_t * mempool); ``` """ function sc_mempool_destroy(mempool) - @ccall libsc.sc_mempool_destroy(mempool::Ptr{sc_mempool_t})::Cvoid + @ccall libt8.sc_mempool_destroy(mempool::Ptr{sc_mempool_t})::Cvoid end """ @@ -2009,7 +2046,7 @@ void sc_mempool_destroy_null (sc_mempool_t ** pmempool); ``` """ function sc_mempool_destroy_null(pmempool) - @ccall libsc.sc_mempool_destroy_null(pmempool::Ptr{Ptr{sc_mempool_t}})::Cvoid + @ccall libt8.sc_mempool_destroy_null(pmempool::Ptr{Ptr{sc_mempool_t}})::Cvoid end """ @@ -2025,7 +2062,7 @@ void sc_mempool_reset (sc_mempool_t * mempool); ``` """ function sc_mempool_reset(mempool) - @ccall libsc.sc_mempool_reset(mempool::Ptr{sc_mempool_t})::Cvoid + @ccall libt8.sc_mempool_reset(mempool::Ptr{sc_mempool_t})::Cvoid end """ @@ -2041,7 +2078,7 @@ void sc_mempool_truncate (sc_mempool_t * mempool); ``` """ function sc_mempool_truncate(mempool) - @ccall libsc.sc_mempool_truncate(mempool::Ptr{sc_mempool_t})::Cvoid + @ccall libt8.sc_mempool_truncate(mempool::Ptr{sc_mempool_t})::Cvoid end """ @@ -2053,7 +2090,7 @@ static inline void * sc_mempool_alloc (sc_mempool_t * mempool); ``` """ function sc_mempool_alloc(mempool) - @ccall libsc.sc_mempool_alloc(mempool::Ptr{sc_mempool_t})::Ptr{Cvoid} + @ccall libt8.sc_mempool_alloc(mempool::Ptr{sc_mempool_t})::Ptr{Cvoid} end """ @@ -2065,7 +2102,7 @@ static inline void sc_mempool_free (sc_mempool_t * mempool, void *elem); ``` """ function sc_mempool_free(mempool, elem) - @ccall libsc.sc_mempool_free(mempool::Ptr{sc_mempool_t}, elem::Ptr{Cvoid})::Cvoid + @ccall libt8.sc_mempool_free(mempool::Ptr{sc_mempool_t}, elem::Ptr{Cvoid})::Cvoid end """ @@ -2126,7 +2163,7 @@ size_t sc_list_memory_used (sc_list_t * list, int is_dynamic); ``` """ function sc_list_memory_used(list, is_dynamic) - @ccall libsc.sc_list_memory_used(list::Ptr{sc_list_t}, is_dynamic::Cint)::Csize_t + @ccall libt8.sc_list_memory_used(list::Ptr{sc_list_t}, is_dynamic::Cint)::Csize_t end """ @@ -2144,7 +2181,7 @@ sc_list_t *sc_list_new (sc_mempool_t * allocator); ``` """ function sc_list_new(allocator) - @ccall libsc.sc_list_new(allocator::Ptr{sc_mempool_t})::Ptr{sc_list_t} + @ccall libt8.sc_list_new(allocator::Ptr{sc_mempool_t})::Ptr{sc_list_t} end """ @@ -2164,7 +2201,7 @@ void sc_list_destroy (sc_list_t * list); ``` """ function sc_list_destroy(list) - @ccall libsc.sc_list_destroy(list::Ptr{sc_list_t})::Cvoid + @ccall libt8.sc_list_destroy(list::Ptr{sc_list_t})::Cvoid end """ @@ -2181,7 +2218,7 @@ void sc_list_init (sc_list_t * list, sc_mempool_t * allocator); ``` """ function sc_list_init(list, allocator) - @ccall libsc.sc_list_init(list::Ptr{sc_list_t}, allocator::Ptr{sc_mempool_t})::Cvoid + @ccall libt8.sc_list_init(list::Ptr{sc_list_t}, allocator::Ptr{sc_mempool_t})::Cvoid end """ @@ -2201,7 +2238,7 @@ void sc_list_reset (sc_list_t * list); ``` """ function sc_list_reset(list) - @ccall libsc.sc_list_reset(list::Ptr{sc_list_t})::Cvoid + @ccall libt8.sc_list_reset(list::Ptr{sc_list_t})::Cvoid end """ @@ -2217,7 +2254,7 @@ void sc_list_unlink (sc_list_t * list); ``` """ function sc_list_unlink(list) - @ccall libsc.sc_list_unlink(list::Ptr{sc_list_t})::Cvoid + @ccall libt8.sc_list_unlink(list::Ptr{sc_list_t})::Cvoid end """ @@ -2236,7 +2273,7 @@ sc_link_t *sc_list_prepend (sc_list_t * list, void *data); ``` """ function sc_list_prepend(list, data) - @ccall libsc.sc_list_prepend(list::Ptr{sc_list_t}, data::Ptr{Cvoid})::Ptr{sc_link_t} + @ccall libt8.sc_list_prepend(list::Ptr{sc_list_t}, data::Ptr{Cvoid})::Ptr{sc_link_t} end """ @@ -2255,7 +2292,7 @@ sc_link_t *sc_list_append (sc_list_t * list, void *data); ``` """ function sc_list_append(list, data) - @ccall libsc.sc_list_append(list::Ptr{sc_list_t}, data::Ptr{Cvoid})::Ptr{sc_link_t} + @ccall libt8.sc_list_append(list::Ptr{sc_list_t}, data::Ptr{Cvoid})::Ptr{sc_link_t} end """ @@ -2275,7 +2312,7 @@ sc_link_t *sc_list_insert (sc_list_t * list, sc_link_t * pred, void *data); ``` """ function sc_list_insert(list, pred, data) - @ccall libsc.sc_list_insert(list::Ptr{sc_list_t}, pred::Ptr{sc_link_t}, data::Ptr{Cvoid})::Ptr{sc_link_t} + @ccall libt8.sc_list_insert(list::Ptr{sc_list_t}, pred::Ptr{sc_link_t}, data::Ptr{Cvoid})::Ptr{sc_link_t} end """ @@ -2294,7 +2331,7 @@ void *sc_list_remove (sc_list_t * list, sc_link_t * pred); ``` """ function sc_list_remove(list, pred) - @ccall libsc.sc_list_remove(list::Ptr{sc_list_t}, pred::Ptr{sc_link_t})::Ptr{Cvoid} + @ccall libt8.sc_list_remove(list::Ptr{sc_list_t}, pred::Ptr{sc_link_t})::Ptr{Cvoid} end """ @@ -2312,7 +2349,7 @@ void *sc_list_pop (sc_list_t * list); ``` """ function sc_list_pop(list) - @ccall libsc.sc_list_pop(list::Ptr{sc_list_t})::Ptr{Cvoid} + @ccall libt8.sc_list_pop(list::Ptr{sc_list_t})::Ptr{Cvoid} end """ @@ -2363,7 +2400,7 @@ unsigned int sc_hash_function_string (const void *s, const void *u); ``` """ function sc_hash_function_string(s, u) - @ccall libsc.sc_hash_function_string(s::Ptr{Cvoid}, u::Ptr{Cvoid})::Cuint + @ccall libt8.sc_hash_function_string(s::Ptr{Cvoid}, u::Ptr{Cvoid})::Cuint end """ @@ -2381,7 +2418,7 @@ size_t sc_hash_memory_used (sc_hash_t * hash); ``` """ function sc_hash_memory_used(hash) - @ccall libsc.sc_hash_memory_used(hash::Ptr{sc_hash_t})::Csize_t + @ccall libt8.sc_hash_memory_used(hash::Ptr{sc_hash_t})::Csize_t end """ @@ -2400,7 +2437,7 @@ sc_hash_t *sc_hash_new (sc_hash_function_t hash_fn, sc_equal_function_t equal_fn ``` """ function sc_hash_new(hash_fn, equal_fn, user_data, allocator) - @ccall libsc.sc_hash_new(hash_fn::sc_hash_function_t, equal_fn::sc_equal_function_t, user_data::Ptr{Cvoid}, allocator::Ptr{sc_mempool_t})::Ptr{sc_hash_t} + @ccall libt8.sc_hash_new(hash_fn::sc_hash_function_t, equal_fn::sc_equal_function_t, user_data::Ptr{Cvoid}, allocator::Ptr{sc_mempool_t})::Ptr{sc_hash_t} end """ @@ -2420,7 +2457,7 @@ void sc_hash_destroy (sc_hash_t * hash); ``` """ function sc_hash_destroy(hash) - @ccall libsc.sc_hash_destroy(hash::Ptr{sc_hash_t})::Cvoid + @ccall libt8.sc_hash_destroy(hash::Ptr{sc_hash_t})::Cvoid end """ @@ -2436,7 +2473,7 @@ void sc_hash_destroy_null (sc_hash_t ** phash); ``` """ function sc_hash_destroy_null(phash) - @ccall libsc.sc_hash_destroy_null(phash::Ptr{Ptr{sc_hash_t}})::Cvoid + @ccall libt8.sc_hash_destroy_null(phash::Ptr{Ptr{sc_hash_t}})::Cvoid end """ @@ -2452,7 +2489,7 @@ void sc_hash_truncate (sc_hash_t * hash); ``` """ function sc_hash_truncate(hash) - @ccall libsc.sc_hash_truncate(hash::Ptr{sc_hash_t})::Cvoid + @ccall libt8.sc_hash_truncate(hash::Ptr{sc_hash_t})::Cvoid end """ @@ -2470,7 +2507,7 @@ void sc_hash_unlink (sc_hash_t * hash); ``` """ function sc_hash_unlink(hash) - @ccall libsc.sc_hash_unlink(hash::Ptr{sc_hash_t})::Cvoid + @ccall libt8.sc_hash_unlink(hash::Ptr{sc_hash_t})::Cvoid end """ @@ -2486,7 +2523,7 @@ void sc_hash_unlink_destroy (sc_hash_t * hash); ``` """ function sc_hash_unlink_destroy(hash) - @ccall libsc.sc_hash_unlink_destroy(hash::Ptr{sc_hash_t})::Cvoid + @ccall libt8.sc_hash_unlink_destroy(hash::Ptr{sc_hash_t})::Cvoid end """ @@ -2506,7 +2543,7 @@ int sc_hash_lookup (sc_hash_t * hash, void *v, void ***found); ``` """ function sc_hash_lookup(hash, v, found) - @ccall libsc.sc_hash_lookup(hash::Ptr{sc_hash_t}, v::Ptr{Cvoid}, found::Ptr{Ptr{Ptr{Cvoid}}})::Cint + @ccall libt8.sc_hash_lookup(hash::Ptr{sc_hash_t}, v::Ptr{Cvoid}, found::Ptr{Ptr{Ptr{Cvoid}}})::Cint end """ @@ -2526,7 +2563,7 @@ int sc_hash_insert_unique (sc_hash_t * hash, void *v, void ***found); ``` """ function sc_hash_insert_unique(hash, v, found) - @ccall libsc.sc_hash_insert_unique(hash::Ptr{sc_hash_t}, v::Ptr{Cvoid}, found::Ptr{Ptr{Ptr{Cvoid}}})::Cint + @ccall libt8.sc_hash_insert_unique(hash::Ptr{sc_hash_t}, v::Ptr{Cvoid}, found::Ptr{Ptr{Ptr{Cvoid}}})::Cint end """ @@ -2546,7 +2583,7 @@ int sc_hash_remove (sc_hash_t * hash, void *v, void **found); ``` """ function sc_hash_remove(hash, v, found) - @ccall libsc.sc_hash_remove(hash::Ptr{sc_hash_t}, v::Ptr{Cvoid}, found::Ptr{Ptr{Cvoid}})::Cint + @ccall libt8.sc_hash_remove(hash::Ptr{sc_hash_t}, v::Ptr{Cvoid}, found::Ptr{Ptr{Cvoid}})::Cint end """ @@ -2563,7 +2600,7 @@ void sc_hash_foreach (sc_hash_t * hash, sc_hash_foreach_t fn); ``` """ function sc_hash_foreach(hash, fn) - @ccall libsc.sc_hash_foreach(hash::Ptr{sc_hash_t}, fn::sc_hash_foreach_t)::Cvoid + @ccall libt8.sc_hash_foreach(hash::Ptr{sc_hash_t}, fn::sc_hash_foreach_t)::Cvoid end """ @@ -2581,7 +2618,7 @@ void sc_hash_print_statistics (int package_id, int log_priority, sc_hash_t * has ``` """ function sc_hash_print_statistics(package_id, log_priority, hash) - @ccall libsc.sc_hash_print_statistics(package_id::Cint, log_priority::Cint, hash::Ptr{sc_hash_t})::Cvoid + @ccall libt8.sc_hash_print_statistics(package_id::Cint, log_priority::Cint, hash::Ptr{sc_hash_t})::Cvoid end mutable struct sc_hash_array_data end @@ -2626,7 +2663,7 @@ size_t sc_hash_array_memory_used (sc_hash_array_t * ha); ``` """ function sc_hash_array_memory_used(ha) - @ccall libsc.sc_hash_array_memory_used(ha::Ptr{sc_hash_array_t})::Csize_t + @ccall libt8.sc_hash_array_memory_used(ha::Ptr{sc_hash_array_t})::Csize_t end """ @@ -2645,7 +2682,7 @@ sc_hash_array_t *sc_hash_array_new (size_t elem_size, sc_hash_function_t hash_fn ``` """ function sc_hash_array_new(elem_size, hash_fn, equal_fn, user_data) - @ccall libsc.sc_hash_array_new(elem_size::Csize_t, hash_fn::sc_hash_function_t, equal_fn::sc_equal_function_t, user_data::Ptr{Cvoid})::Ptr{sc_hash_array_t} + @ccall libt8.sc_hash_array_new(elem_size::Csize_t, hash_fn::sc_hash_function_t, equal_fn::sc_equal_function_t, user_data::Ptr{Cvoid})::Ptr{sc_hash_array_t} end """ @@ -2661,7 +2698,7 @@ void sc_hash_array_destroy (sc_hash_array_t * hash_array); ``` """ function sc_hash_array_destroy(hash_array) - @ccall libsc.sc_hash_array_destroy(hash_array::Ptr{sc_hash_array_t})::Cvoid + @ccall libt8.sc_hash_array_destroy(hash_array::Ptr{sc_hash_array_t})::Cvoid end """ @@ -2679,7 +2716,7 @@ int sc_hash_array_is_valid (sc_hash_array_t * hash_array); ``` """ function sc_hash_array_is_valid(hash_array) - @ccall libsc.sc_hash_array_is_valid(hash_array::Ptr{sc_hash_array_t})::Cint + @ccall libt8.sc_hash_array_is_valid(hash_array::Ptr{sc_hash_array_t})::Cint end """ @@ -2695,7 +2732,7 @@ void sc_hash_array_truncate (sc_hash_array_t * hash_array); ``` """ function sc_hash_array_truncate(hash_array) - @ccall libsc.sc_hash_array_truncate(hash_array::Ptr{sc_hash_array_t})::Cvoid + @ccall libt8.sc_hash_array_truncate(hash_array::Ptr{sc_hash_array_t})::Cvoid end """ @@ -2715,7 +2752,7 @@ int sc_hash_array_lookup (sc_hash_array_t * hash_array, void *v, size_t *positio ``` """ function sc_hash_array_lookup(hash_array, v, position) - @ccall libsc.sc_hash_array_lookup(hash_array::Ptr{sc_hash_array_t}, v::Ptr{Cvoid}, position::Ptr{Csize_t})::Cint + @ccall libt8.sc_hash_array_lookup(hash_array::Ptr{sc_hash_array_t}, v::Ptr{Cvoid}, position::Ptr{Csize_t})::Cint end """ @@ -2735,7 +2772,7 @@ void *sc_hash_array_insert_unique (sc_hash_array_t * hash_array, void *v, size_t ``` """ function sc_hash_array_insert_unique(hash_array, v, position) - @ccall libsc.sc_hash_array_insert_unique(hash_array::Ptr{sc_hash_array_t}, v::Ptr{Cvoid}, position::Ptr{Csize_t})::Ptr{Cvoid} + @ccall libt8.sc_hash_array_insert_unique(hash_array::Ptr{sc_hash_array_t}, v::Ptr{Cvoid}, position::Ptr{Csize_t})::Ptr{Cvoid} end """ @@ -2752,7 +2789,7 @@ void sc_hash_array_foreach (sc_hash_array_t * hash_array, sc_hash_foreach_t fn); ``` """ function sc_hash_array_foreach(hash_array, fn) - @ccall libsc.sc_hash_array_foreach(hash_array::Ptr{sc_hash_array_t}, fn::sc_hash_foreach_t)::Cvoid + @ccall libt8.sc_hash_array_foreach(hash_array::Ptr{sc_hash_array_t}, fn::sc_hash_foreach_t)::Cvoid end """ @@ -2769,7 +2806,7 @@ void sc_hash_array_rip (sc_hash_array_t * hash_array, sc_array_t * rip); ``` """ function sc_hash_array_rip(hash_array, rip) - @ccall libsc.sc_hash_array_rip(hash_array::Ptr{sc_hash_array_t}, rip::Ptr{sc_array_t})::Cvoid + @ccall libt8.sc_hash_array_rip(hash_array::Ptr{sc_hash_array_t}, rip::Ptr{sc_array_t})::Cvoid end """ @@ -2812,7 +2849,7 @@ void sc_recycle_array_init (sc_recycle_array_t * rec_array, size_t elem_size); ``` """ function sc_recycle_array_init(rec_array, elem_size) - @ccall libsc.sc_recycle_array_init(rec_array::Ptr{sc_recycle_array_t}, elem_size::Csize_t)::Cvoid + @ccall libt8.sc_recycle_array_init(rec_array::Ptr{sc_recycle_array_t}, elem_size::Csize_t)::Cvoid end """ @@ -2828,7 +2865,7 @@ void sc_recycle_array_reset (sc_recycle_array_t * rec_array); ``` """ function sc_recycle_array_reset(rec_array) - @ccall libsc.sc_recycle_array_reset(rec_array::Ptr{sc_recycle_array_t})::Cvoid + @ccall libt8.sc_recycle_array_reset(rec_array::Ptr{sc_recycle_array_t})::Cvoid end """ @@ -2847,7 +2884,7 @@ void *sc_recycle_array_insert (sc_recycle_array_t * rec_array, size_t *position) ``` """ function sc_recycle_array_insert(rec_array, position) - @ccall libsc.sc_recycle_array_insert(rec_array::Ptr{sc_recycle_array_t}, position::Ptr{Csize_t})::Ptr{Cvoid} + @ccall libt8.sc_recycle_array_insert(rec_array::Ptr{sc_recycle_array_t}, position::Ptr{Csize_t})::Ptr{Cvoid} end """ @@ -2866,7 +2903,7 @@ void *sc_recycle_array_remove (sc_recycle_array_t * rec_array, size_t position); ``` """ function sc_recycle_array_remove(rec_array, position) - @ccall libsc.sc_recycle_array_remove(rec_array::Ptr{sc_recycle_array_t}, position::Csize_t)::Ptr{Cvoid} + @ccall libt8.sc_recycle_array_remove(rec_array::Ptr{sc_recycle_array_t}, position::Csize_t)::Ptr{Cvoid} end """A type for storing SFC indices""" @@ -2877,13 +2914,15 @@ const t8_linearidx_t = UInt64 Communication tags used internal to t8code. -| Enumerator | Note | -| :------------------------------------- | :-------------------------------------------------- | -| T8\\_MPI\\_PARTITION\\_CMESH | Used for coarse mesh partitioning | -| T8\\_MPI\\_PARTITION\\_FOREST | Used for forest partitioning | -| T8\\_MPI\\_GHOST\\_FOREST | Used for for ghost layer creation | -| T8\\_MPI\\_GHOST\\_EXC\\_FOREST | Used for ghost data exchange | -| T8\\_MPI\\_TEST\\_ELEMENT\\_PACK\\_TAG | Used for testing mpi pack and unpack functionality | +| Enumerator | Note | +| :------------------------------------------ | :-------------------------------------------------- | +| T8\\_MPI\\_PARTITION\\_CMESH | Used for coarse mesh partitioning | +| T8\\_MPI\\_PARTITION\\_FOREST | Used for forest partitioning | +| T8\\_MPI\\_GHOST\\_FOREST | Used for for ghost layer creation | +| T8\\_MPI\\_GHOST\\_EXC\\_FOREST | Used for ghost data exchange | +| T8\\_MPI\\_CMESH\\_UNIFORM\\_BOUNDS\\_START | Used for cmesh uniform bounds computation. | +| T8\\_MPI\\_CMESH\\_UNIFORM\\_BOUNDS\\_END | | +| T8\\_MPI\\_TEST\\_ELEMENT\\_PACK\\_TAG | Used for testing mpi pack and unpack functionality | """ @cenum t8_MPI_tag_t::UInt32 begin T8_MPI_TAG_FIRST = 214 @@ -2891,8 +2930,10 @@ Communication tags used internal to t8code. T8_MPI_PARTITION_FOREST = 296 T8_MPI_GHOST_FOREST = 297 T8_MPI_GHOST_EXC_FOREST = 298 - T8_MPI_TEST_ELEMENT_PACK_TAG = 299 - T8_MPI_TAG_LAST = 300 + T8_MPI_CMESH_UNIFORM_BOUNDS_START = 299 + T8_MPI_CMESH_UNIFORM_BOUNDS_END = 300 + T8_MPI_TEST_ELEMENT_PACK_TAG = 301 + T8_MPI_TAG_LAST = 302 end # automatic type deduction for variadic arguments may not be what you want, please use with caution @@ -2968,13 +3009,29 @@ end :(@ccall(libt8.t8_errorf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) end +""" + t8_set_external_log_fcn(log_fcn) + +Set a custom logging function to be used by t8code. When setting a custom logging function, the t8code internal logging function will be ignored. + +# Arguments +* `log_fcn`:\\[in\\] A function pointer to a logging function +### Prototype +```c +void t8_set_external_log_fcn (void (*log_fcn) (int category, int priority, const char *msg)); +``` +""" +function t8_set_external_log_fcn(log_fcn) + @ccall libt8.t8_set_external_log_fcn(log_fcn::Ptr{Cvoid})::Cvoid +end + """ t8_init(log_threshold) Register t8code with libsc and print version and variable information. # Arguments -* `log_threshold`:\\[in\\] Declared in sc.h. `SC_LP_DEFAULT` is fine. You can also choose from log levels SC\\_LP\\_*. +* `log_threshold`:\\[in\\] Declared in sc.h. [`SC_LP_DEFAULT`](@ref) is fine. You can also choose from log levels SC\\_LP\\_*. ### Prototype ```c void t8_init (int log_threshold); @@ -2985,14721 +3042,13602 @@ function t8_init(log_threshold) end """ - t8_sc_array_index_locidx(array, it) + t8_sc_array_index_locidx(array, index) Return a pointer to an array element indexed by a [`t8_locidx_t`](@ref). # Arguments +* `array`:\\[in\\] The array of elements. * `index`:\\[in\\] needs to be in [0]..[elem\\_count-1]. # Returns -A void * pointing to entry *it* in *array*. +A void * pointing to entry *index* in *array*. ### Prototype ```c -void * t8_sc_array_index_locidx (const sc_array_t *array, const t8_locidx_t it); +void * t8_sc_array_index_locidx (const sc_array_t *array, const t8_locidx_t index); ``` """ -function t8_sc_array_index_locidx(array, it) - @ccall libt8.t8_sc_array_index_locidx(array::Ptr{sc_array_t}, it::t8_locidx_t)::Ptr{Cvoid} +function t8_sc_array_index_locidx(array, index) + @ccall libt8.t8_sc_array_index_locidx(array::Ptr{sc_array_t}, index::t8_locidx_t)::Ptr{Cvoid} end """ - sc_shmem_type_t - -` sc_shmem.h ` - -| Enumerator | Note | -| :---------------------------- | :------------------------------------------- | -| SC\\_SHMEM\\_BASIC | use allgathers, then sum to simulate scan | -| SC\\_SHMEM\\_PRESCAN | mpi\\_scan, then allgather | -| SC\\_SHMEM\\_WINDOW | MPI\\_Win (requires MPI 3) | -| SC\\_SHMEM\\_WINDOW\\_PRESCAN | mpi\\_scan, then MPI\\_Win (requires MPI 3) | -""" -@cenum sc_shmem_type_t::UInt32 begin - SC_SHMEM_BASIC = 0 - SC_SHMEM_PRESCAN = 1 - SC_SHMEM_WINDOW = 2 - SC_SHMEM_WINDOW_PRESCAN = 3 - SC_SHMEM_NUM_TYPES = 4 - SC_SHMEM_NOT_SET = 5 -end + t8_eclass_count_boundary(theclass, min_dim, per_eclass) -""" - sc_shmem_set_type(comm, type) +Query the element class and count of boundary points. +# Arguments +* `theclass`:\\[in\\] We query a point of this element class. +* `min_dim`:\\[in\\] Ignore boundary points of lesser dimension. The ignored points get a count value of 0. +* `per_eclass`:\\[out\\] Array of length T8\\_ECLASS\\_COUNT to be filled with the count of the boundary objects, counted per each of the element classes. +# Returns +The count over all boundary points. ### Prototype ```c -void sc_shmem_set_type (sc_MPI_Comm comm, sc_shmem_type_t type); +int t8_eclass_count_boundary (t8_eclass_t theclass, int min_dim, int *per_eclass); ``` """ -function sc_shmem_set_type(comm, type) - @ccall libsc.sc_shmem_set_type(comm::MPI_Comm, type::sc_shmem_type_t)::Cvoid +function t8_eclass_count_boundary(theclass, min_dim, per_eclass) + @ccall libt8.t8_eclass_count_boundary(theclass::t8_eclass_t, min_dim::Cint, per_eclass::Ptr{Cint})::Cint end """ - sc_shmem_get_type(comm) + t8_eclass_compare(eclass1, eclass2) +Compare two eclasses of the same dimension as necessary for face neighbor orientation. The implemented order is Triangle < Square in 2D and Tet < Hex < Prism < Pyramid in 3D. + +# Arguments +* `eclass1`:\\[in\\] The first eclass to compare. +* `eclass2`:\\[in\\] The second eclass to compare. +# Returns +0 if the eclasses are equal, 1 if eclass1 > eclass2 and -1 if eclass1 < eclass2 ### Prototype ```c -sc_shmem_type_t sc_shmem_get_type (sc_MPI_Comm comm); +int t8_eclass_compare (t8_eclass_t eclass1, t8_eclass_t eclass2); ``` """ -function sc_shmem_get_type(comm) - @ccall libsc.sc_shmem_get_type(comm::MPI_Comm)::sc_shmem_type_t +function t8_eclass_compare(eclass1, eclass2) + @ccall libt8.t8_eclass_compare(eclass1::t8_eclass_t, eclass2::t8_eclass_t)::Cint end """ - sc_shmem_write_start(array, comm) + t8_eclass_is_valid(eclass) + +Check whether a class is a valid class. Returns non-zero if it is a valid class, returns zero, if the class is equal to T8\\_ECLASS\\_INVALID. +# Arguments +* `eclass`:\\[in\\] The eclass to check. +# Returns +Non-zero if *eclass* is valid, zero otherwise. ### Prototype ```c -int sc_shmem_write_start (void *array, sc_MPI_Comm comm); +int t8_eclass_is_valid (t8_eclass_t eclass); ``` """ -function sc_shmem_write_start(array, comm) - @ccall libsc.sc_shmem_write_start(array::Ptr{Cvoid}, comm::MPI_Comm)::Cint +function t8_eclass_is_valid(eclass) + @ccall libt8.t8_eclass_is_valid(eclass::t8_eclass_t)::Cint end +mutable struct t8_element end + +"""Opaque structure for a generic element, only used as pointer. Implementations are free to cast it to their internal data structure.""" +const t8_element_t = t8_element + +"""Type definition for the geometric shape of an element. Currently the possible shapes are the same as the possible element classes. I.e. T8\\_ECLASS\\_VERTEX, T8\\_ECLASS\\_TET, etc...""" +const t8_element_shape_t = t8_eclass_t + """ - sc_shmem_write_end(array, comm) + t8_element_shape_num_faces(element_shape) + +The number of codimension-one boundaries of an element class. ### Prototype ```c -void sc_shmem_write_end (void *array, sc_MPI_Comm comm); +int t8_element_shape_num_faces (int element_shape); ``` """ -function sc_shmem_write_end(array, comm) - @ccall libsc.sc_shmem_write_end(array::Ptr{Cvoid}, comm::MPI_Comm)::Cvoid +function t8_element_shape_num_faces(element_shape) + @ccall libt8.t8_element_shape_num_faces(element_shape::Cint)::Cint end """ - sc_shmem_memcpy(destarray, srcarray, bytes, comm) + t8_element_shape_max_num_faces(element_shape) + +For each dimension the maximum possible number of faces of an element\\_shape of that dimension. ### Prototype ```c -void sc_shmem_memcpy (void *destarray, void *srcarray, size_t bytes, sc_MPI_Comm comm); +int t8_element_shape_max_num_faces (int element_shape); ``` """ -function sc_shmem_memcpy(destarray, srcarray, bytes, comm) - @ccall libsc.sc_shmem_memcpy(destarray::Ptr{Cvoid}, srcarray::Ptr{Cvoid}, bytes::Csize_t, comm::MPI_Comm)::Cvoid +function t8_element_shape_max_num_faces(element_shape) + @ccall libt8.t8_element_shape_max_num_faces(element_shape::Cint)::Cint end """ - sc_shmem_allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm) + t8_element_shape_num_vertices(element_shape) + +The number of vertices of an element class. ### Prototype ```c -void sc_shmem_allgather (void *sendbuf, int sendcount, sc_MPI_Datatype sendtype, void *recvbuf, int recvcount, sc_MPI_Datatype recvtype, sc_MPI_Comm comm); +int t8_element_shape_num_vertices (int element_shape); ``` """ -function sc_shmem_allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm) - @ccall libsc.sc_shmem_allgather(sendbuf::Ptr{Cvoid}, sendcount::Cint, sendtype::Cint, recvbuf::Ptr{Cvoid}, recvcount::Cint, recvtype::Cint, comm::MPI_Comm)::Cvoid +function t8_element_shape_num_vertices(element_shape) + @ccall libt8.t8_element_shape_num_vertices(element_shape::Cint)::Cint end """ - sc_shmem_prefix(sendbuf, recvbuf, count, type, op, comm) + t8_element_shape_vtk_type(element_shape) + +The vtk cell type for the element\\_shape ### Prototype ```c -void sc_shmem_prefix (void *sendbuf, void *recvbuf, int count, sc_MPI_Datatype type, sc_MPI_Op op, sc_MPI_Comm comm); +int t8_element_shape_vtk_type (int element_shape); ``` """ -function sc_shmem_prefix(sendbuf, recvbuf, count, type, op, comm) - @ccall libsc.sc_shmem_prefix(sendbuf::Ptr{Cvoid}, recvbuf::Ptr{Cvoid}, count::Cint, type::Cint, op::Cint, comm::MPI_Comm)::Cvoid +function t8_element_shape_vtk_type(element_shape) + @ccall libt8.t8_element_shape_vtk_type(element_shape::Cint)::Cint end """ - sc_refcount + t8_element_shape_t8_to_vtk_corner_number(element_shape, index) -The refcount structure is declared in public so its size is known. Its members should really never be accessed directly. +Maps the t8code corner number of the element to the vtk corner number -| Field | Note | -| :----------- | :----------------------------------------------------------- | -| package\\_id | The sc package that uses this reference counter. | -| refcount | The reference count is always positive for a valid counter. | +# Arguments +* `element_shape`:\\[in\\] The shape of the element. +* `index`:\\[in\\] The index of the corner in z-order (t8code numeration). +# Returns +The corresponding vtk index. +### Prototype +```c +int t8_element_shape_t8_to_vtk_corner_number (int element_shape, int index); +``` """ -struct sc_refcount - package_id::Cint - refcount::Cint +function t8_element_shape_t8_to_vtk_corner_number(element_shape, index) + @ccall libt8.t8_element_shape_t8_to_vtk_corner_number(element_shape::Cint, index::Cint)::Cint end -"""The refcount structure is declared in public so its size is known. Its members should really never be accessed directly.""" -const sc_refcount_t = sc_refcount - """ - sc_refcount_init_invalid(rc) + t8_element_shape_t8_corner_number(element_shape, index) -Initialize a well-defined but unusable reference counter. Specifically, we set its package identifier and reference count to -1. To make this reference counter usable, call sc_refcount_init. +Maps the vtk corner number of the element to the t8code corner number # Arguments -* `rc`:\\[out\\] This reference counter is defined as invalid. It will return false on both sc_refcount_is_active and sc_refcount_is_last. It can be made valid by calling sc_refcount_init. No other functions must be called on it. +* `element_shape`:\\[in\\] The shape of the element. +* `index`:\\[in\\] The index of the corner in vtk ordering. +# Returns +The corresponding t8code index. ### Prototype ```c -void sc_refcount_init_invalid (sc_refcount_t * rc); +int t8_element_shape_t8_corner_number (int element_shape, int index); ``` """ -function sc_refcount_init_invalid(rc) - @ccall libsc.sc_refcount_init_invalid(rc::Ptr{sc_refcount_t})::Cvoid +function t8_element_shape_t8_corner_number(element_shape, index) + @ccall libt8.t8_element_shape_t8_corner_number(element_shape::Cint, index::Cint)::Cint end """ - sc_refcount_init(rc, package_id) + t8_element_shape_to_string(element_shape) -Initialize a reference counter to 1. It is legal if its status prior to this call is undefined. +For each element\\_shape, the name of this class as a string -# Arguments -* `rc`:\\[out\\] This reference counter is initialized to one. The object's contents may be undefined on input. -* `package_id`:\\[in\\] Either -1 or a package registered to libsc. ### Prototype ```c -void sc_refcount_init (sc_refcount_t * rc, int package_id); +const char* t8_element_shape_to_string (int element_shape); ``` """ -function sc_refcount_init(rc, package_id) - @ccall libsc.sc_refcount_init(rc::Ptr{sc_refcount_t}, package_id::Cint)::Cvoid +function t8_element_shape_to_string(element_shape) + @ccall libt8.t8_element_shape_to_string(element_shape::Cint)::Cstring end """ - sc_refcount_new(package_id) + t8_element_shape_compare(element_shape1, element_shape2) -Create a new reference counter with count initialized to 1. Equivalent to calling sc_refcount_init on a newly allocated rc object. +Compare two element\\_shapes of the same dimension as necessary for face neighbor orientation. The implemented order is Triangle < Square in 2D and Tet < Hex < Prism < Pyramid in 3D. # Arguments -* `package_id`:\\[in\\] Either -1 or a package registered to libsc. +* `element_shape1`:\\[in\\] The first element\\_shape to compare. +* `element_shape2`:\\[in\\] The second element\\_shape to compare. # Returns -A reference counter with count one. +0 if the element\\_shapes are equal, 1 if element\\_shape1 > element\\_shape2 and -1 if element\\_shape1 < element\\_shape2 ### Prototype ```c -sc_refcount_t *sc_refcount_new (int package_id); +int t8_element_shape_compare (t8_element_shape_t element_shape1, t8_element_shape_t element_shape2); ``` """ -function sc_refcount_new(package_id) - @ccall libsc.sc_refcount_new(package_id::Cint)::Ptr{sc_refcount_t} +function t8_element_shape_compare(element_shape1, element_shape2) + @ccall libt8.t8_element_shape_compare(element_shape1::t8_element_shape_t, element_shape2::t8_element_shape_t)::Cint end """ - sc_refcount_destroy(rc) + t8_mat_init_xrot(mat, angle) -Destroy a reference counter. It must have been counted down to zero before, thus reached an inactive state. +Initialize given 3x3 matrix as rotation matrix around the x-axis with given angle. # Arguments -* `rc`:\\[in,out\\] This reference counter must have reached count zero. +* `mat`:\\[in,out\\] 3x3-matrix. +* `angle`:\\[in\\] Rotation angle in radians. ### Prototype ```c -void sc_refcount_destroy (sc_refcount_t * rc); +static inline void t8_mat_init_xrot (double mat[3][3], const double angle); ``` """ -function sc_refcount_destroy(rc) - @ccall libsc.sc_refcount_destroy(rc::Ptr{sc_refcount_t})::Cvoid +function t8_mat_init_xrot(mat, angle) + @ccall libt8.t8_mat_init_xrot(mat::Ptr{NTuple{3, Cdouble}}, angle::Cdouble)::Cvoid end """ - sc_refcount_ref(rc) + t8_mat_init_yrot(mat, angle) -Increase a reference counter. The counter must be active, that is, have a value greater than zero. +Initialize given 3x3 matrix as rotation matrix around the y-axis with given angle. # Arguments -* `rc`:\\[in,out\\] This reference counter must be valid (greater zero). Its count is increased by one. +* `mat`:\\[in,out\\] 3x3-matrix. +* `angle`:\\[in\\] Rotation angle in radians. ### Prototype ```c -void sc_refcount_ref (sc_refcount_t * rc); +static inline void t8_mat_init_yrot (double mat[3][3], const double angle); ``` """ -function sc_refcount_ref(rc) - @ccall libsc.sc_refcount_ref(rc::Ptr{sc_refcount_t})::Cvoid +function t8_mat_init_yrot(mat, angle) + @ccall libt8.t8_mat_init_yrot(mat::Ptr{NTuple{3, Cdouble}}, angle::Cdouble)::Cvoid end """ - sc_refcount_unref(rc) + t8_mat_init_zrot(mat, angle) -Decrease the reference counter and notify when it reaches zero. The count must be greater zero on input. If the reference count reaches zero, which is indicated by the return value, the counter may not be used further with sc_refcount_ref or +Initialize given 3x3 matrix as rotation matrix around the z-axis with given angle. # Arguments -* `rc`:\\[in,out\\] This reference counter must be valid (greater zero). Its count is decreased by one. -# Returns -True if the count has reached zero, false otherwise. -# See also -[`sc_refcount_unref`](@ref). It is legal, however, to reactivate it later by calling, [`sc_refcount_init`](@ref). - +* `mat`:\\[in,out\\] 3x3-matrix. +* `angle`:\\[in\\] Rotation angle in radians. ### Prototype ```c -int sc_refcount_unref (sc_refcount_t * rc); +static inline void t8_mat_init_zrot (double mat[3][3], const double angle); ``` """ -function sc_refcount_unref(rc) - @ccall libsc.sc_refcount_unref(rc::Ptr{sc_refcount_t})::Cint +function t8_mat_init_zrot(mat, angle) + @ccall libt8.t8_mat_init_zrot(mat::Ptr{NTuple{3, Cdouble}}, angle::Cdouble)::Cvoid end """ - sc_refcount_is_active(rc) + t8_mat_mult_vec(mat, a, b) -Check whether a reference counter has a positive value. This means that the reference counter is in use and corresponds to a live object. +Apply matrix-matrix multiplication: b = M*a. # Arguments -* `rc`:\\[in\\] A reference counter. -# Returns -True if the count is greater zero, false otherwise. +* `mat`:\\[in\\] 3x3-matrix. +* `a`:\\[in\\] 3-vector. +* `b`:\\[in,out\\] 3-vector. ### Prototype ```c -int sc_refcount_is_active (const sc_refcount_t * rc); +static inline void t8_mat_mult_vec (const double mat[3][3], const double a[3], double b[3]); ``` """ -function sc_refcount_is_active(rc) - @ccall libsc.sc_refcount_is_active(rc::Ptr{sc_refcount_t})::Cint +function t8_mat_mult_vec(mat, a, b) + @ccall libt8.t8_mat_mult_vec(mat::Ptr{NTuple{3, Cdouble}}, a::Ptr{Cdouble}, b::Ptr{Cdouble})::Cvoid end """ - sc_refcount_is_last(rc) + t8_mat_mult_mat(A, B, C) -Check whether a reference counter has value one. This means that this counter is the last of its kind, which we may optimize for. +Apply matrix-matrix multiplication: C = A*B. # Arguments -* `rc`:\\[in\\] A reference counter. -# Returns -True if the count is exactly one. +* `A`:\\[in\\] 3x3-matrix. +* `B`:\\[in\\] 3x3-matrix. +* `C`:\\[in,out\\] 3x3-matrix. ### Prototype ```c -int sc_refcount_is_last (const sc_refcount_t * rc); +static inline void t8_mat_mult_mat (const double A[3][3], const double B[3][3], double C[3][3]); ``` """ -function sc_refcount_is_last(rc) - @ccall libsc.sc_refcount_is_last(rc::Ptr{sc_refcount_t})::Cint +function t8_mat_mult_mat(A, B, C) + @ccall libt8.t8_mat_mult_mat(A::Ptr{NTuple{3, Cdouble}}, B::Ptr{NTuple{3, Cdouble}}, C::Ptr{NTuple{3, Cdouble}})::Cvoid end -mutable struct t8_eclass_scheme end - -"""This typedef holds virtual functions for a particular element class.""" -const t8_eclass_scheme_c = t8_eclass_scheme - """ - t8_scheme_cxx + sc_refcount -The scheme holds implementations for one or more element classes. +The refcount structure is declared in public so its size is known. Its members should really never be accessed directly. -| Field | Note | -| :--------------- | :----------------------------------------------------- | -| rc | Reference counter for this scheme. | -| eclass\\_schemes | This array holds one virtual table per element class. | +| Field | Note | +| :----------- | :----------------------------------------------------------- | +| package\\_id | The sc package that uses this reference counter. | +| refcount | The reference count is always positive for a valid counter. | """ -struct t8_scheme_cxx - rc::sc_refcount_t - eclass_schemes::NTuple{8, Ptr{t8_eclass_scheme_c}} +struct sc_refcount + package_id::Cint + refcount::Cint end -"""The scheme holds implementations for one or more element classes.""" -const t8_scheme_cxx_t = t8_scheme_cxx +"""The refcount structure is declared in public so its size is known. Its members should really never be accessed directly.""" +const sc_refcount_t = sc_refcount -"""We can reuse the reference counter type from libsc.""" -const t8_refcount_t = sc_refcount_t +""" + sc_refcount_ref(rc) -struct t8_cmesh_trees - from_proc::Ptr{sc_array_t} - tree_to_proc::Ptr{Cint} - ghost_to_proc::Ptr{Cint} - ghost_globalid_to_local_id::Ptr{sc_hash_t} - global_local_mempool::Ptr{sc_mempool_t} -end +Increase a reference counter. The counter must be active, that is, have a value greater than zero. -const t8_cmesh_trees_t = Ptr{t8_cmesh_trees} +# Arguments +* `rc`:\\[in,out\\] This reference counter must be valid (greater zero). Its count is increased by one. +### Prototype +```c +void sc_refcount_ref (sc_refcount_t * rc); +``` +""" +function sc_refcount_ref(rc) + @ccall libt8.sc_refcount_ref(rc::Ptr{sc_refcount_t})::Cvoid +end -mutable struct t8_shmem_array end +""" + sc_refcount_unref(rc) -const t8_shmem_array_t = Ptr{t8_shmem_array} +Decrease the reference counter and notify when it reaches zero. The count must be greater zero on input. If the reference count reaches zero, which is indicated by the return value, the counter may not be used further with sc_refcount_ref or -mutable struct t8_geometry_handler end +# Arguments +* `rc`:\\[in,out\\] This reference counter must be valid (greater zero). Its count is decreased by one. +# Returns +True if the count has reached zero, false otherwise. +# See also +[`sc_refcount_unref`](@ref). It is legal, however, to reactivate it later by calling, [`sc_refcount_init`](@ref). -"""This typedef holds virtual functions for the geometry handler. We need it so that we can use [`t8_geometry_handler_c`](@ref) pointers in .c files without them seeing the actual C++ code (and then not compiling) TODO: Delete this when the cmesh is a proper cpp class.""" -const t8_geometry_handler_c = t8_geometry_handler +### Prototype +```c +int sc_refcount_unref (sc_refcount_t * rc); +``` +""" +function sc_refcount_unref(rc) + @ccall libt8.sc_refcount_unref(rc::Ptr{sc_refcount_t})::Cint +end """ - t8_stash + sc_refcount_is_active(rc) -The stash data structure is used to store information about the cmesh before it is committed. In particular we store the eclasses of the trees, the face-connections and the tree attributes. Using the stash structure allows us to have a very flexible interface. When constructing a new mesh, the user can specify all these mesh entities in arbitrary order. As soon as the cmesh is committed the information is copied from the stash to the cmesh in an order mannered. +Check whether a reference counter has a positive value. This means that the reference counter is in use and corresponds to a live object. -| Field | Note | -| :--------- | :---------------------------------------------------------------------- | -| classes | Stores the eclasses of the trees. # See also [`t8_stash_class`](@ref) | -| joinfaces | Stores the face-connections. # See also [`t8_stash_joinface`](@ref) | -| attributes | Stores the attributes. # See also [`t8_stash_attribute`](@ref) | +# Arguments +* `rc`:\\[in\\] A reference counter. +# Returns +True if the count is greater zero, false otherwise. +### Prototype +```c +int sc_refcount_is_active (const sc_refcount_t * rc); +``` """ -struct t8_stash - classes::sc_array_t - joinfaces::sc_array_t - attributes::sc_array_t +function sc_refcount_is_active(rc) + @ccall libt8.sc_refcount_is_active(rc::Ptr{sc_refcount_t})::Cint end -const t8_stash_t = Ptr{t8_stash} - """ - t8_cprofile + sc_refcount_is_last(rc) -This struct is used to profile cmesh algorithms. The cmesh struct stores a pointer to a profile struct, and if it is nonzero, various runtimes and data measurements are stored here. +Check whether a reference counter has value one. This means that this counter is the last of its kind, which we may optimize for. -| Field | Note | -| :-------------------------------- | :------------------------------------------------------------------------------------------------------------ | -| partition\\_trees\\_shipped | The number of trees this process has sent to other in the last partition call. | -| partition\\_ghosts\\_shipped | The number of ghosts this process has sent to other in the last partition call. | -| partition\\_trees\\_recv | The number of trees this process has received from other in the last partition call. | -| partition\\_ghosts\\_recv | The number of ghosts this process has received from other in the last partition call. | -| partition\\_bytes\\_sent | The total number of bytes sent to other processes in the last partition call. | -| partition\\_procs\\_sent | The number of different processes this process has send local trees or ghosts to in the last partition call. | -| first\\_tree\\_shared | 1 if this processes' first tree is shared. 0 if not. | -| partition\\_runtime | The runtime of the last call to [`t8_cmesh_partition`](@ref). | -| commit\\_runtime | The runtime of the last call to [`t8_cmesh_commit`](@ref). | -| geometry\\_evaluate\\_num\\_calls | The number of calls to [`t8_geometry_evaluate`](@ref). | -| geometry\\_evaluate\\_runtime | The accumulated runtime of calls to [`t8_geometry_evaluate`](@ref). | -# See also -[`t8_cmesh_set_profiling`](@ref) and, [`t8_cmesh_print_profile`](@ref) +# Arguments +* `rc`:\\[in\\] A reference counter. +# Returns +True if the count is exactly one. +### Prototype +```c +int sc_refcount_is_last (const sc_refcount_t * rc); +``` """ -struct t8_cprofile - partition_trees_shipped::t8_locidx_t - partition_ghosts_shipped::t8_locidx_t - partition_trees_recv::t8_locidx_t - partition_ghosts_recv::t8_locidx_t - partition_bytes_sent::Csize_t - partition_procs_sent::Cint - first_tree_shared::Cint - partition_runtime::Cdouble - commit_runtime::Cdouble - geometry_evaluate_num_calls::Cdouble - geometry_evaluate_runtime::Cdouble +function sc_refcount_is_last(rc) + @ccall libt8.sc_refcount_is_last(rc::Ptr{sc_refcount_t})::Cint end """ -This struct is used to profile cmesh algorithms. The cmesh struct stores a pointer to a profile struct, and if it is nonzero, various runtimes and data measurements are stored here. + sc_refcount_init_invalid(rc) -# See also -[`t8_cmesh_set_profiling`](@ref) and, [`t8_cmesh_print_profile`](@ref) -""" -const t8_cprofile_t = t8_cprofile - -""" - t8_cmesh - -This structure holds the connectivity data of the coarse mesh. It can either be replicated, then each process stores a copy of the whole mesh, or partitioned. In the latter case, each process only stores a local portion of the mesh plus information about ghost elements. - -The coarse mesh is a collection of coarse trees that can be identified along faces. TODO: this description is outdated. rewrite it. The array ctrees stores these coarse trees sorted by their (global) tree\\_id. If the mesh if partitioned it is partitioned according to an (possible only virtually existing) underlying fine mesh. Therefore the ctrees array can store duplicated trees on different processes, if each of these processes owns elements of the same tree in the fine mesh. - -Each tree stores information about its face-neighbours in an array of t8_ctree_fneighbor. - -If partitioned the ghost trees are stored in a hash table that is backed up by an array. The hash value of a ghost tree is its tree\\_id modulo the number of ghosts on this process. - -| Field | Note | -| :--------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| committed | Flag that specifies whether the cmesh is committed or not. t8_cmesh_commit | -| dimension | The dimension of the cmesh. It is set when the first tree is inserted. | -| set\\_partition | If nonzero the cmesh is partitioned. If zero each process has the whole cmesh. | -| face\\_knowledge | If partitioned the level of face knowledge that is expected. t8_mesh_set_partitioned; see t8_cmesh_set_partition. | -| set\\_partition\\_scheme | If the cmesh is to be partitioned according to a uniform level, the scheme that describes the refinement pattern. See t8_cmesh_set_partition. | -| set\\_partition\\_level | Non-negative if the cmesh should be partitioned from an already existing cmesh with an assumed *level* uniform mesh underneath. | -| set\\_from | If this cmesh shall be derived from an existing cmesh by copy or more elaborate modification, we store a pointer to this other cmesh here. | -| mpirank | Number of this MPI process. | -| mpisize | Number of MPI processes. | -| rc | The reference count of the cmesh. | -| num\\_trees | The global number of trees | -| num\\_local\\_trees | If partitioned the number of trees on this process. Otherwise the global number of trees. | -| num\\_ghosts | If partitioned the number of neighbor trees owned by different processes. | -| num\\_local\\_trees\\_per\\_eclass | After commit the number of local trees for each eclass. Stores the same entries as *num_trees_per_eclass*, if the cmesh is replicated. | -| num\\_trees\\_per\\_eclass | After commit the number of global trees for each eclass. | -| trees | structure that holds all local trees and ghosts | -| first\\_tree | The global index of the first local tree on this process. Zero if the cmesh is not partitioned. -1 if this processor is empty. See also https://github.com/DLR-AMR/t8code/wiki/Tree-indexing | -| first\\_tree\\_shared | If partitioned true if the first tree on this process is also the last tree on the next process. Always zero if num\\_local\\_trees = 0 | -| tree\\_offsets | If partitioned for each process the global index of its first local tree or -(first local tree) - 1 if the first tree on that process is shared. Since this is very memory consuming we only fill it when needed. | -| geometry\\_handler | Handles all geometries that are used by trees in this cmesh. | -| stash | Used as temporary storage for the trees before commit. | -| profile | Used to measure runtimes and statistics of the cmesh algorithms. | -# See also -t8\\_ctree\\_fneighbor +Initialize a well-defined but unusable reference counter. Specifically, we set its package identifier and reference count to -1. To make this reference counter usable, call sc_refcount_init. + +# Arguments +* `rc`:\\[out\\] This reference counter is defined as invalid. It will return false on both sc_refcount_is_active and sc_refcount_is_last. It can be made valid by calling sc_refcount_init. No other functions must be called on it. +### Prototype +```c +void sc_refcount_init_invalid (sc_refcount_t * rc); +``` """ -struct t8_cmesh - committed::Cint - dimension::Cint - set_partition::Cint - face_knowledge::Cint - set_partition_scheme::Ptr{t8_scheme_cxx_t} - set_partition_level::Int8 - set_from::Ptr{t8_cmesh} - mpirank::Cint - mpisize::Cint - rc::t8_refcount_t - num_trees::t8_gloidx_t - num_local_trees::t8_locidx_t - num_ghosts::t8_locidx_t - num_local_trees_per_eclass::NTuple{8, t8_locidx_t} - num_trees_per_eclass::NTuple{8, t8_gloidx_t} - trees::t8_cmesh_trees_t - first_tree::t8_gloidx_t - first_tree_shared::Int8 - tree_offsets::t8_shmem_array_t - geometry_handler::Ptr{t8_geometry_handler_c} - stash::t8_stash_t - profile::Ptr{t8_cprofile_t} +function sc_refcount_init_invalid(rc) + @ccall libt8.sc_refcount_init_invalid(rc::Ptr{sc_refcount_t})::Cvoid end -const t8_cmesh_t = Ptr{t8_cmesh} - """ - t8_eclass + sc_refcount_init(rc, package_id) -This enumeration contains all possible element classes. +Initialize a reference counter to 1. It is legal if its status prior to this call is undefined. -| Enumerator | Note | -| :--------------------- | :----------------------------------------------------------------------------------------------------------------- | -| T8\\_ECLASS\\_VERTEX | The vertex is the only zero-dimensional element class. | -| T8\\_ECLASS\\_LINE | The line is the only one-dimensional element class. | -| T8\\_ECLASS\\_QUAD | The quadrilateral is one of two element classes in two dimensions. | -| T8\\_ECLASS\\_TRIANGLE | The element class for a triangle. | -| T8\\_ECLASS\\_HEX | The hexahedron is one three-dimensional element class. | -| T8\\_ECLASS\\_TET | The tetrahedron is another three-dimensional element class. | -| T8\\_ECLASS\\_PRISM | The prism has five sides: two opposing triangles joined by three quadrilaterals. | -| T8\\_ECLASS\\_PYRAMID | The pyramid has a quadrilateral as base and four triangles as sides. | -| T8\\_ECLASS\\_COUNT | This is no element class but can be used as the number of element classes. | -| T8\\_ECLASS\\_INVALID | This is no element class but can be used for the case a class of a third party library is not supported by t8code | +# Arguments +* `rc`:\\[out\\] This reference counter is initialized to one. The object's contents may be undefined on input. +* `package_id`:\\[in\\] Either -1 or a package registered to libsc. +### Prototype +```c +void sc_refcount_init (sc_refcount_t * rc, int package_id); +``` """ -@cenum t8_eclass::UInt32 begin - T8_ECLASS_ZERO = 0 - T8_ECLASS_VERTEX = 0 - T8_ECLASS_LINE = 1 - T8_ECLASS_QUAD = 2 - T8_ECLASS_TRIANGLE = 3 - T8_ECLASS_HEX = 4 - T8_ECLASS_TET = 5 - T8_ECLASS_PRISM = 6 - T8_ECLASS_PYRAMID = 7 - T8_ECLASS_COUNT = 8 - T8_ECLASS_INVALID = 9 +function sc_refcount_init(rc, package_id) + @ccall libt8.sc_refcount_init(rc::Ptr{sc_refcount_t}, package_id::Cint)::Cvoid end -"""This enumeration contains all possible element classes.""" -const t8_eclass_t = t8_eclass - """ - t8_ctree + sc_refcount_new(package_id) -This structure holds the data of a local tree including the information about face neighbors. For those the tree\\_to\\_face index is computed as follows. Let F be the maximal number of faces of any eclass of the cmesh's dimension, then ttf % F is the face number and ttf / F is the orientation. (t8_eclass_max_num_faces) The orientation is determined as follows. Let my\\_face and other\\_face be the two face numbers of the connecting trees. We chose a main\\_face from them as follows: Either both trees have the same element class, then the face with the lower face number is the main\\_face or the trees belong to different classes in which case the face belonging to the tree with the lower class according to the ordering triangle < square, hex < tet < prism < pyramid, is the main\\_face. Then face corner 0 of the main\\_face connects to a face corner k in the other face. The face orientation is defined as the number k. If the classes are equal and my\\_face == other\\_face, treating either of both faces as the main\\_face leads to the same result. See https://arxiv.org/pdf/1611.02929.pdf for more details. +Create a new reference counter with count initialized to 1. Equivalent to calling sc_refcount_init on a newly allocated rc object. -| Field | Note | -| :--------------- | :------------------------------------------------------------------------------------------ | -| treeid | The local number of this tree. | -| eclass | The eclass of this tree. | -| neigh\\_offset | Adding this offset to the address of the tree yields the array of face\\_neighbor entries | -| att\\_offset | Adding this offset to the address of the tree yields the array of attribute\\_info entries | -| num\\_attributes | The number of attributes at this tree | +# Arguments +* `package_id`:\\[in\\] Either -1 or a package registered to libsc. +# Returns +A reference counter with count one. +### Prototype +```c +sc_refcount_t *sc_refcount_new (int package_id); +``` """ -struct t8_ctree - treeid::t8_locidx_t - eclass::t8_eclass_t - neigh_offset::Csize_t - att_offset::Csize_t - num_attributes::Cint +function sc_refcount_new(package_id) + @ccall libt8.sc_refcount_new(package_id::Cint)::Ptr{sc_refcount_t} end -const t8_ctree_t = Ptr{t8_ctree} - """ - t8_cghost + sc_refcount_destroy(rc) + +Destroy a reference counter. It must have been counted down to zero before, thus reached an inactive state. -| Field | Note | -| :--------------- | :------------------------------------------------------------------------------------------- | -| treeid | The global number of this ghost. | -| eclass | The eclass of this ghost. | -| att\\_offset | Adding this offset to the address of the ghost yields the array of attribute\\_info entries | -| num\\_attributes | The number of attributes at this ghost | +# Arguments +* `rc`:\\[in,out\\] This reference counter must have reached count zero. +### Prototype +```c +void sc_refcount_destroy (sc_refcount_t * rc); +``` """ -struct t8_cghost - treeid::t8_gloidx_t - eclass::t8_eclass_t - neigh_offset::Csize_t - att_offset::Csize_t - num_attributes::Cint +function sc_refcount_destroy(rc) + @ccall libt8.sc_refcount_destroy(rc::Ptr{sc_refcount_t})::Cvoid end -const t8_cghost_t = Ptr{t8_cghost} +"""We can reuse the reference counter type from libsc.""" +const t8_refcount_t = sc_refcount_t """ - t8_cmesh_init(pcmesh) + t8_refcount_init(rc) -Create a new cmesh with reference count one. This cmesh needs to be specialized with the t8\\_cmesh\\_set\\_* calls. Then it needs to be set up with t8_cmesh_commit. +Initialize a reference counter to 1. It is legal if its status prior to this call is undefined. # Arguments -* `pcmesh`:\\[in,out\\] On input, this pointer must be non-NULL. On return, this pointer set to the new cmesh. +* `rc`:\\[out\\] The reference counter is set to one by this call. ### Prototype ```c -void t8_cmesh_init (t8_cmesh_t *pcmesh); +void t8_refcount_init (t8_refcount_t *rc); ``` """ -function t8_cmesh_init(pcmesh) - @ccall libt8.t8_cmesh_init(pcmesh::Ptr{t8_cmesh_t})::Cvoid +function t8_refcount_init(rc) + @ccall libt8.t8_refcount_init(rc::Ptr{t8_refcount_t})::Cvoid end -# no prototype is found for this function at t8_cmesh.h:76:1, please use with caution """ - t8_cmesh_new() + t8_refcount_new() -Allocate a new un-committed cmesh. +Create a new reference counter with count initialized to 1. Equivalent to calling [`t8_refcount_init`](@ref) on a newly allocated refcount\\_t. It is mandatory to free this with t8_refcount_destroy. # Returns -A pointer to an un-committed [`t8_cmesh`](@ref) structure. +An allocated reference counter whose count has been set to one. ### Prototype ```c -t8_cmesh_t t8_cmesh_new (); +t8_refcount_t * t8_refcount_new (void); ``` """ -function t8_cmesh_new() - @ccall libt8.t8_cmesh_new()::t8_cmesh_t +function t8_refcount_new() + @ccall libt8.t8_refcount_new()::Ptr{t8_refcount_t} end """ - t8_cmesh_is_initialized(cmesh) + t8_refcount_destroy(rc) -Check whether a cmesh is not NULL, initialized and not committed. In addition, it asserts that the cmesh is consistent as much as possible. +Destroy a reference counter that we allocated with t8_refcount_new. Its reference count must have decreased to zero. # Arguments -* `cmesh`:\\[in\\] This cmesh is examined. May be NULL. -# Returns -True if cmesh is not NULL, t8_cmesh_init has been called on it, but not t8_cmesh_commit. False otherwise. +* `rc`:\\[in,out\\] Allocated, formerly valid reference counter. ### Prototype ```c -int t8_cmesh_is_initialized (t8_cmesh_t cmesh); +void t8_refcount_destroy (t8_refcount_t *rc); ``` """ -function t8_cmesh_is_initialized(cmesh) - @ccall libt8.t8_cmesh_is_initialized(cmesh::t8_cmesh_t)::Cint +function t8_refcount_destroy(rc) + @ccall libt8.t8_refcount_destroy(rc::Ptr{t8_refcount_t})::Cvoid end """ - t8_cmesh_is_committed(cmesh) + t8_norm(vec) -Check whether a cmesh is not NULL, initialized and committed. In addition, it asserts that the cmesh is consistent as much as possible. +Vector norm. # Arguments -* `cmesh`:\\[in\\] This cmesh is examined. May be NULL. +* `vec`:\\[in\\] A 3D vector. # Returns -True if cmesh is not NULL and t8_cmesh_init has been called on it as well as t8_cmesh_commit. False otherwise. +The norm of *vec*. ### Prototype ```c -int t8_cmesh_is_committed (const t8_cmesh_t cmesh); +double t8_norm (const double vec[3]); ``` """ -function t8_cmesh_is_committed(cmesh) - @ccall libt8.t8_cmesh_is_committed(cmesh::t8_cmesh_t)::Cint +function t8_norm(vec) + @ccall libt8.t8_norm(vec::Ptr{Cdouble})::Cdouble end """ - t8_cmesh_tree_vertices_negative_volume(eclass, vertices, num_vertices) + t8_normalize(vec) -Given a set of vertex coordinates for a tree of a given eclass. Query whether the geometric volume of the tree with this coordinates would be negative. +Normalize a vector. # Arguments -* `eclass`:\\[in\\] The eclass of a tree. -* `vertices`:\\[in\\] The coordinates of the tree's vertices. -* `num_vertices`:\\[in\\] The number of vertices. *vertices* must hold 3 * *num_vertices* many doubles. *num_vertices* must match t8_eclass_num_vertices[*eclass*] -# Returns -True if the geometric volume describe by *vertices* is negative. False otherwise. Returns true if a tree of the given eclass with the given vertex coordinates does have negative volume. +* `vec`:\\[in,out\\] A 3D vector. ### Prototype ```c -int t8_cmesh_tree_vertices_negative_volume (const t8_eclass_t eclass, const double *vertices, const int num_vertices); +void t8_normalize (double vec[3]); ``` """ -function t8_cmesh_tree_vertices_negative_volume(eclass, vertices, num_vertices) - @ccall libt8.t8_cmesh_tree_vertices_negative_volume(eclass::t8_eclass_t, vertices::Ptr{Cdouble}, num_vertices::Cint)::Cint +function t8_normalize(vec) + @ccall libt8.t8_normalize(vec::Ptr{Cdouble})::Cvoid end """ - t8_cmesh_set_derive(cmesh, set_from) + t8_copy(dimensional_in, dimensional_out) -This function sets a cmesh to be derived from. The default is to create a cmesh standalone by specifying all data manually. A coarse mesh can also be constructed by deriving it from an existing one. The derivation from another cmesh may optionally be combined with a repartition or uniform refinement of each tree. This function overrides a previously set cmesh to be derived from. +Make a copy of a dimensional object. # Arguments -* `cmesh`:\\[in,out\\] Must be initialized, but not committed. May even be NULL to revert to standalone. -* `set_from`:\\[in,out\\] Reference counter on this cmesh is bumped. It will be unbumped by t8_cmesh_commit, after which *from* is no longer remembered. Other than that the from object is not changed. +* `dimensional_in`:\\[in\\] +* `dimensional_out`:\\[out\\] ### Prototype ```c -void t8_cmesh_set_derive (t8_cmesh_t cmesh, t8_cmesh_t set_from); +void t8_copy (const double dimensional_in[3], double dimensional_out[3]); ``` """ -function t8_cmesh_set_derive(cmesh, set_from) - @ccall libt8.t8_cmesh_set_derive(cmesh::t8_cmesh_t, set_from::t8_cmesh_t)::Cvoid +function t8_copy(dimensional_in, dimensional_out) + @ccall libt8.t8_copy(dimensional_in::Ptr{Cdouble}, dimensional_out::Ptr{Cdouble})::Cvoid end """ - t8_cmesh_alloc_offsets(mpisize, comm) + t8_dist(vec_x, vec_y) + +Euclidean distance of X and Y. +# Arguments +* `vec_x`:\\[in\\] A 3D vector. +* `vec_y`:\\[in\\] A 3D vector. +# Returns +The euclidean distance. Equivalent to norm (X-Y). ### Prototype ```c -t8_shmem_array_t t8_cmesh_alloc_offsets (int mpisize, sc_MPI_Comm comm); +double t8_dist (const double vec_x[3], const double vec_y[3]); ``` """ -function t8_cmesh_alloc_offsets(mpisize, comm) - @ccall libt8.t8_cmesh_alloc_offsets(mpisize::Cint, comm::MPI_Comm)::t8_shmem_array_t +function t8_dist(vec_x, vec_y) + @ccall libt8.t8_dist(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble})::Cdouble end """ - t8_cmesh_set_partition_range(cmesh, set_face_knowledge, first_local_tree, last_local_tree) + t8_ax(vec_x, alpha) -Declare if the cmesh is understood as a partitioned cmesh and specify the processor local tree range. This function should be preferred over t8_cmesh_set_partition_offsets when the cmesh is not derived from another cmesh. This call is only valid when the cmesh is not yet committed via a call to t8_cmesh_commit. - -!!! note - - A value of *set_face_knowledge* other than -1 or 3 is not yet supported. +Compute X = alpha * X # Arguments -* `cmesh`:\\[in,out\\] The cmesh to be updated. -* `set_face_knowledge`:\\[in\\] Several values are possible that define how much information is required on face connections, specified by t8_cmesh_set_join. 0: Expect face connection of local trees. 1: In addition, expect face connection from ghost trees to local trees. 2: In addition, expect face connection between ghost trees. 3: Expect face connection of local and ghost trees. Consistency of this requirement is checked on t8_cmesh_commit. -1: Do not change the face\\_knowledge level but keep any previously set ones. (Possibly by a previous call to t8_cmesh_set_partition_range) -* `first_local_tree`:\\[in\\] The global index ID of the first tree on this process. If this tree is also the last tree on the previous process, then the argument must be -ID - 1. -* `last_local_tree`:\\[in\\] The global index of the last tree on this process. If this process should be empty then *last_local_tree* must be strictly smaller than *first_local_tree*. -# See also -t8\\_cmesh\\_set\\_partition\\_offset, [`t8_cmesh_set_partition_uniform`](@ref) - +* `vec_x`:\\[in,out\\] A 3D vector. On output set to *alpha* * *vec_x*. +* `alpha`:\\[in\\] A factor. ### Prototype ```c -void t8_cmesh_set_partition_range (t8_cmesh_t cmesh, int set_face_knowledge, t8_gloidx_t first_local_tree, t8_gloidx_t last_local_tree); +void t8_ax (double vec_x[3], const double alpha); ``` """ -function t8_cmesh_set_partition_range(cmesh, set_face_knowledge, first_local_tree, last_local_tree) - @ccall libt8.t8_cmesh_set_partition_range(cmesh::t8_cmesh_t, set_face_knowledge::Cint, first_local_tree::t8_gloidx_t, last_local_tree::t8_gloidx_t)::Cvoid +function t8_ax(vec_x, alpha) + @ccall libt8.t8_ax(vec_x::Ptr{Cdouble}, alpha::Cdouble)::Cvoid end """ - t8_cmesh_set_partition_offsets(cmesh, tree_offsets) + t8_axy(vec_x, vec_y, alpha) -Declare if the cmesh is understood as a partitioned cmesh and specify the first local tree for each process. This call is only valid when the cmesh is not yet committed via a call to t8_cmesh_commit. If instead t8_cmesh_set_partition_range was called and the cmesh is derived then the offset array is constructed during commit. +Compute Y = alpha * X # Arguments -* `cmesh`:\\[in,out\\] The cmesh to be updated. -* `tree_offsets`:\\[in\\] An array of global tree\\_id offsets for each process can be specified here. TODO: document flag for shared trees. +* `vec_x`:\\[in\\] A 3D vector. +* `vec_y`:\\[out\\] On output set to *alpha* * *vec_x*. +* `alpha`:\\[in\\] A factor. ### Prototype ```c -void t8_cmesh_set_partition_offsets (t8_cmesh_t cmesh, t8_shmem_array_t tree_offsets); +void t8_axy (const double vec_x[3], double vec_y[3], const double alpha); ``` """ -function t8_cmesh_set_partition_offsets(cmesh, tree_offsets) - @ccall libt8.t8_cmesh_set_partition_offsets(cmesh::t8_cmesh_t, tree_offsets::t8_shmem_array_t)::Cvoid +function t8_axy(vec_x, vec_y, alpha) + @ccall libt8.t8_axy(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, alpha::Cdouble)::Cvoid end """ - t8_cmesh_set_partition_uniform(cmesh, element_level, ts) + t8_axb(vec_x, vec_y, alpha, b) -Declare if a derived cmesh should be partitioned according to a uniform refinement of a given level for the provided scheme. This call is only valid when the cmesh is not yet committed via a call to t8_cmesh_commit and when the cmesh will be derived. +Y = alpha * X + b + +!!! note + + It is possible that vec\\_x = vec\\_y on input to overwrite x # Arguments -* `cmesh`:\\[in,out\\] The cmesh to be updated. -* `element_level`:\\[in\\] The refinement\\_level. -* `ts`:\\[in\\] The element scheme describing the refinement pattern. We take ownership. This can be prevented by referencing **ts** before calling this function. +* `vec_x`:\\[in\\] A 3D vector. +* `vec_y`:\\[out\\] On input, a 3D vector. On output set to *alpha* * *vec_x* + *b*. +* `alpha`:\\[in\\] A factor. +* `b`:\\[in\\] An offset. ### Prototype ```c -void t8_cmesh_set_partition_uniform (t8_cmesh_t cmesh, int element_level, t8_scheme_cxx_t *ts); +void t8_axb (const double vec_x[3], double vec_y[3], const double alpha, const double b); ``` """ -function t8_cmesh_set_partition_uniform(cmesh, element_level, ts) - @ccall libt8.t8_cmesh_set_partition_uniform(cmesh::t8_cmesh_t, element_level::Cint, ts::Ptr{t8_scheme_cxx_t})::Cvoid +function t8_axb(vec_x, vec_y, alpha, b) + @ccall libt8.t8_axb(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, alpha::Cdouble, b::Cdouble)::Cvoid end """ - t8_cmesh_set_refine(cmesh, level, scheme) + t8_axpy(vec_x, vec_y, alpha) -Refine the cmesh to a given level. Thus split each tree into x^level subtrees TODO: implement +Y = Y + alpha * X +# Arguments +* `vec_x`:\\[in\\] A 3D vector. +* `vec_y`:\\[in,out\\] On input, a 3D vector. On output set *to* vec\\_y + *alpha* * *vec_x* +* `alpha`:\\[in\\] A factor. ### Prototype ```c -void t8_cmesh_set_refine (t8_cmesh_t cmesh, int level, t8_scheme_cxx_t *scheme); +void t8_axpy (const double vec_x[3], double vec_y[3], const double alpha); ``` """ -function t8_cmesh_set_refine(cmesh, level, scheme) - @ccall libt8.t8_cmesh_set_refine(cmesh::t8_cmesh_t, level::Cint, scheme::Ptr{t8_scheme_cxx_t})::Cvoid +function t8_axpy(vec_x, vec_y, alpha) + @ccall libt8.t8_axpy(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, alpha::Cdouble)::Cvoid end """ - t8_cmesh_set_dimension(cmesh, dim) + t8_axpyz(vec_x, vec_y, vec_z, alpha) -Set the dimension of a cmesh. If any tree is inserted to the cmesh via [`t8_cmesh_set_tree_class`](@ref), then the dimension is set automatically to that of the inserted tree. However, if the cmesh is constructed partitioned and the part on this process is empty, it is necessary to set the dimension by hand. +Z = Y + alpha * X # Arguments -* `cmesh`:\\[in,out\\] The cmesh to be updated. -* `dim`:\\[in\\] The dimension to be set. Must satisfy 0 <= dim <= 3. The cmesh must not be committed before calling this function. +* `vec_x`:\\[in\\] A 3D vector. +* `vec_y`:\\[in\\] A 3D vector. +* `vec_z`:\\[out\\] On output set *to* vec\\_y + *alpha* * *vec_x* +* `alpha`:\\[in\\] A factor for the multiplication of *vec_x*. ### Prototype ```c -void t8_cmesh_set_dimension (t8_cmesh_t cmesh, int dim); +void t8_axpyz (const double vec_x[3], const double vec_y[3], double vec_z[3], const double alpha); ``` """ -function t8_cmesh_set_dimension(cmesh, dim) - @ccall libt8.t8_cmesh_set_dimension(cmesh::t8_cmesh_t, dim::Cint)::Cvoid +function t8_axpyz(vec_x, vec_y, vec_z, alpha) + @ccall libt8.t8_axpyz(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, vec_z::Ptr{Cdouble}, alpha::Cdouble)::Cvoid end """ - t8_cmesh_set_tree_class(cmesh, gtree_id, tree_class) + t8_dot(vec_x, vec_y) -Set the class of a tree in the cmesh. It is not allowed to call this function after t8_cmesh_commit. It is not allowed to call this function multiple times for the same tree. +Dot product of X and Y. # Arguments -* `cmesh`:\\[in,out\\] The cmesh to be updated. -* `tree_id`:\\[in\\] The global number of the tree. -* `tree_class`:\\[in\\] The element class of this tree. +* `vec_x`:\\[in\\] A 3D vector. +* `vec_y`:\\[in\\] A 3D vector. +# Returns +The dot product *vec_x* * *vec_y* ### Prototype ```c -void t8_cmesh_set_tree_class (t8_cmesh_t cmesh, t8_gloidx_t gtree_id, t8_eclass_t tree_class); +double t8_dot (const double vec_x[3], const double vec_y[3]); ``` """ -function t8_cmesh_set_tree_class(cmesh, gtree_id, tree_class) - @ccall libt8.t8_cmesh_set_tree_class(cmesh::t8_cmesh_t, gtree_id::t8_gloidx_t, tree_class::t8_eclass_t)::Cvoid +function t8_dot(vec_x, vec_y) + @ccall libt8.t8_dot(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble})::Cdouble end """ - t8_cmesh_set_attribute(cmesh, gtree_id, package_id, key, data, data_size, data_persists) + t8_cross_3D(vec_x, vec_y, cross) -Store an attribute at a tree in a cmesh. Attributes can be arbitrary data that is copied to an internal storage associated to the tree. Each application can set multiple attributes and attributes are distinguished by an integer key, where each application can use any integer as key. - -!!! note - - If an attribute with the given package\\_id and key already exists, then it will get overwritten. +Cross product of X and Y # Arguments -* `cmesh`:\\[in,out\\] The cmesh to be updated. -* `gtree_id`:\\[in\\] The global id of the tree. -* `package_id`:\\[in\\] Unique identifier of a valid software package. -* `key`:\\[in\\] An integer key used to identify this attribute under all attributes with the same package\\_id. *key* must be a unique value for this tree and package\\_id. -* `data`:\\[in\\] A pointer to the attribute data. -* `data_size`:\\[in\\] The number of bytes of the attribute. -* `data_persists`:\\[in\\] This flag can be used to optimize memory. If true then t8code assumes that the attribute data is present at the memory that *data* points to when t8_cmesh_commit is called (This is more memory efficient). If the flag is false an internal copy of the data is created immediately and this copy is used at commit. In both cases a copy of the data is used by t8\\_code after [`t8_cmesh_commit`](@ref). -# See also -[`sc_package_register`](@ref) - +* `vec_x`:\\[in\\] A 3D vector. +* `vec_y`:\\[in\\] A 3D vector. +* `cross`:\\[out\\] On output, the cross product of *vec_x* and *vec_y*. ### Prototype ```c -void t8_cmesh_set_attribute (t8_cmesh_t cmesh, t8_gloidx_t gtree_id, int package_id, int key, void *data, size_t data_size, int data_persists); +void t8_cross_3D (const double vec_x[3], const double vec_y[3], double cross[3]); ``` """ -function t8_cmesh_set_attribute(cmesh, gtree_id, package_id, key, data, data_size, data_persists) - @ccall libt8.t8_cmesh_set_attribute(cmesh::t8_cmesh_t, gtree_id::t8_gloidx_t, package_id::Cint, key::Cint, data::Ptr{Cvoid}, data_size::Csize_t, data_persists::Cint)::Cvoid +function t8_cross_3D(vec_x, vec_y, cross) + @ccall libt8.t8_cross_3D(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, cross::Ptr{Cdouble})::Cvoid end """ - t8_cmesh_set_attribute_string(cmesh, gtree_id, package_id, key, string) - -Store a string as an attribute at a tree in a cmesh. - -!!! note - - You can also use t8_cmesh_set_attribute, but we recommend using this specialized function for strings. - -!!! note + t8_cross_2D(vec_x, vec_y) - If an attribute with the given package\\_id and key already exists, then it will get overwritten. +Cross product of X and Y # Arguments -* `cmesh`:\\[in,out\\] The cmesh to be updated. -* `gtree_id`:\\[in\\] The global id of the tree. -* `package_id`:\\[in\\] Unique identifier of a valid software package. -* `key`:\\[in\\] An integer key used to identify this attribute under all attributes with the same package\\_id. *key* must be a unique value for this tree and package\\_id. -* `string`:\\[in\\] The string to store as attribute. -# See also -[`sc_package_register`](@ref) - +* `vec_x`:\\[in\\] A 2D vector. +* `vec_y`:\\[in\\] A 2D vector. +# Returns +The cross product of *vec_x* and *vec_y*. ### Prototype ```c -void t8_cmesh_set_attribute_string (t8_cmesh_t cmesh, t8_gloidx_t gtree_id, int package_id, int key, const char *string); +double t8_cross_2D (const double vec_x[2], const double vec_y[2]); ``` """ -function t8_cmesh_set_attribute_string(cmesh, gtree_id, package_id, key, string) - @ccall libt8.t8_cmesh_set_attribute_string(cmesh::t8_cmesh_t, gtree_id::t8_gloidx_t, package_id::Cint, key::Cint, string::Cstring)::Cvoid +function t8_cross_2D(vec_x, vec_y) + @ccall libt8.t8_cross_2D(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble})::Cdouble end """ - t8_cmesh_set_attribute_gloidx_array(cmesh, gtree_id, package_id, key, data, data_count, data_persists) - -Store an array of [`t8_gloidx_t`](@ref) as an attribute at a tree in a cmesh. - -!!! note - - You can also use t8_cmesh_set_attribute, but we recommend using this specialized function for arrays. - -!!! note - - If an attribute with the given package\\_id and key already exists, then it will get overwritten. + t8_diff(vec_x, vec_y, diff) -!!! note - - We do not store the number of data entries *data_count* of the attribute array. You can keep track of the data count yourself by using another attribute. +Compute the difference of two vectors. # Arguments -* `cmesh`:\\[in,out\\] The cmesh to be updated. -* `gtree_id`:\\[in\\] The global id of the tree. -* `package_id`:\\[in\\] Unique identifier of a valid software package. -* `key`:\\[in\\] An integer key used to identify this attribute under all attributes with the same package\\_id. *key* must be a unique value for this tree and package\\_id. -* `data`:\\[in\\] The array to store as attribute. -* `data_count`:\\[in\\] The number of entries in *data*. -* `data_persists`:\\[in\\] This flag can be used to optimize memory. If true then t8code assumes that the attribute data is present at the memory that *data* points to when t8_cmesh_commit is called (This is more memory efficient). If the flag is false an internal copy of the data is created immediately and this copy is used at commit. In both cases a copy of the data is used by t8\\_code after [`t8_cmesh_commit`](@ref). -# See also -[`sc_package_register`](@ref) - +* `vec_x`:\\[in\\] A 3D vector. +* `vec_y`:\\[in\\] A 3D vector. +* `diff`:\\[out\\] On output, the difference of *vec_x* and *vec_y*. ### Prototype ```c -void t8_cmesh_set_attribute_gloidx_array (t8_cmesh_t cmesh, t8_gloidx_t gtree_id, int package_id, int key, const t8_gloidx_t *data, const size_t data_count, int data_persists); +void t8_diff (const double vec_x[3], const double vec_y[3], double diff[3]); ``` """ -function t8_cmesh_set_attribute_gloidx_array(cmesh, gtree_id, package_id, key, data, data_count, data_persists) - @ccall libt8.t8_cmesh_set_attribute_gloidx_array(cmesh::t8_cmesh_t, gtree_id::t8_gloidx_t, package_id::Cint, key::Cint, data::Ptr{t8_gloidx_t}, data_count::Csize_t, data_persists::Cint)::Cvoid +function t8_diff(vec_x, vec_y, diff) + @ccall libt8.t8_diff(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, diff::Ptr{Cdouble})::Cvoid end """ - t8_cmesh_set_join(cmesh, gtree1, gtree2, face1, face2, orientation) + t8_eq(vec_x, vec_y, tol) -Insert a face-connection between two trees in a cmesh. +Check the equality of two vectors elementwise # Arguments -* `cmesh`:\\[in,out\\] The cmesh to be updated. -* `tree1`:\\[in\\] The tree id of the first of the two trees. -* `tree2`:\\[in\\] The tree id of the second of the two trees. -* `face1`:\\[in\\] The face number of the first tree. -* `face2`:\\[in\\] The face number of the second tree. -* `orientation`:\\[in\\] Specify how face1 and face2 are oriented to each other TODO: orientation needs to be carefully defined for all element classes. TODO: document orientation +* `vec_x`:\\[in\\] +* `vec_y`:\\[in\\] +* `tol`:\\[in\\] +# Returns +true, if the vectors are equal up to *tol* ### Prototype ```c -void t8_cmesh_set_join (t8_cmesh_t cmesh, t8_gloidx_t gtree1, t8_gloidx_t gtree2, int face1, int face2, int orientation); +int t8_eq (const double vec_x[3], const double vec_y[3], const double tol); ``` """ -function t8_cmesh_set_join(cmesh, gtree1, gtree2, face1, face2, orientation) - @ccall libt8.t8_cmesh_set_join(cmesh::t8_cmesh_t, gtree1::t8_gloidx_t, gtree2::t8_gloidx_t, face1::Cint, face2::Cint, orientation::Cint)::Cvoid +function t8_eq(vec_x, vec_y, tol) + @ccall libt8.t8_eq(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, tol::Cdouble)::Cint end """ - t8_cmesh_set_profiling(cmesh, set_profiling) - -Enable or disable profiling for a cmesh. If profiling is enabled, runtimes and statistics are collected during cmesh\\_commit. + t8_rescale(vec, new_length) -Profiling is disabled by default. The cmesh must not be committed before calling this function. +Rescale a vector to a new length. # Arguments -* `cmesh`:\\[in,out\\] The cmesh to be updated. -* `set_profiling`:\\[in\\] If true, profiling will be enabled, if false disabled. -# See also -[`t8_cmesh_print_profile`](@ref) - +* `vec`:\\[in,out\\] A 3D vector. +* `new_length`:\\[in\\] New length of the vector. ### Prototype ```c -void t8_cmesh_set_profiling (t8_cmesh_t cmesh, int set_profiling); +void t8_rescale (double vec[3], const double new_length); ``` """ -function t8_cmesh_set_profiling(cmesh, set_profiling) - @ccall libt8.t8_cmesh_set_profiling(cmesh::t8_cmesh_t, set_profiling::Cint)::Cvoid +function t8_rescale(vec, new_length) + @ccall libt8.t8_rescale(vec::Ptr{Cdouble}, new_length::Cdouble)::Cvoid end """ - t8_cmesh_is_equal(cmesh_a, cmesh_b) + t8_normal_of_tri(p1, p2, p3, normal) -Check whether two given cmeshes carry the same information. +Compute the normal of a triangle given by its three vertices. # Arguments -* `cmesh_a`:\\[in\\] The first of the two cmeshes to be checked. -* `cmesh_b`:\\[in\\] The second of the two cmeshes to be checked. -# Returns -True if both cmeshes carry the same information, false otherwise. TODO: define carefully. Orders, sequences, equivalences? This function works on committed and uncommitted cmeshes. +* `p1`:\\[in\\] A 3D vector. +* `p2`:\\[in\\] A 3D vector. +* `p3`:\\[in\\] A 3D vector. +* `normal`:\\[out\\] vector of the triangle. (Not necessarily of length 1!) ### Prototype ```c -int t8_cmesh_is_equal (t8_cmesh_t cmesh_a, t8_cmesh_t cmesh_b); +void t8_normal_of_tri (const double p1[3], const double p2[3], const double p3[3], double normal[3]); ``` """ -function t8_cmesh_is_equal(cmesh_a, cmesh_b) - @ccall libt8.t8_cmesh_is_equal(cmesh_a::t8_cmesh_t, cmesh_b::t8_cmesh_t)::Cint +function t8_normal_of_tri(p1, p2, p3, normal) + @ccall libt8.t8_normal_of_tri(p1::Ptr{Cdouble}, p2::Ptr{Cdouble}, p3::Ptr{Cdouble}, normal::Ptr{Cdouble})::Cvoid end """ - t8_cmesh_is_empty(cmesh) + t8_orthogonal_tripod(v1, v2, v3) -Check whether a cmesh is empty on all processes. +Compute an orthogonal coordinate system from a given vector. # Arguments -* `cmesh`:\\[in\\] A committed cmesh. -# Returns -True (non-zero) if and only if the cmesh has trees at all. +* `v1`:\\[in\\] 3D vector. +* `v2`:\\[out\\] 3D vector. +* `v3`:\\[out\\] 3D vector. ### Prototype ```c -int t8_cmesh_is_empty (t8_cmesh_t cmesh); +void t8_orthogonal_tripod (const double v1[3], double v2[3], double v3[3]); ``` """ -function t8_cmesh_is_empty(cmesh) - @ccall libt8.t8_cmesh_is_empty(cmesh::t8_cmesh_t)::Cint +function t8_orthogonal_tripod(v1, v2, v3) + @ccall libt8.t8_orthogonal_tripod(v1::Ptr{Cdouble}, v2::Ptr{Cdouble}, v3::Ptr{Cdouble})::Cvoid end """ - t8_cmesh_bcast(cmesh_in, root, comm) + t8_swap(p1, p2) + +Swap the components of two vectors. +# Arguments +* `p1`:\\[in,out\\] A 3D vector. +* `p2`:\\[in,out\\] A 3D vector. ### Prototype ```c -t8_cmesh_t t8_cmesh_bcast (t8_cmesh_t cmesh_in, int root, sc_MPI_Comm comm); +void t8_swap (double p1[3], double p2[3]); ``` """ -function t8_cmesh_bcast(cmesh_in, root, comm) - @ccall libt8.t8_cmesh_bcast(cmesh_in::t8_cmesh_t, root::Cint, comm::MPI_Comm)::t8_cmesh_t +function t8_swap(p1, p2) + @ccall libt8.t8_swap(p1::Ptr{Cdouble}, p2::Ptr{Cdouble})::Cvoid end -mutable struct t8_geometry end - -"""This typedef holds virtual functions for a particular geometry. We need it so that we can use [`t8_geometry_c`](@ref) pointers in .c files without them seeing the actual C++ code (and then not compiling)""" -const t8_geometry_c = t8_geometry - +# no prototype is found for this function at t8_version.h:67:1, please use with caution """ - t8_cmesh_register_geometry(cmesh, geometry) - -Register a geometry in the cmesh. The cmesh takes ownership of the geometry. - -If no geometry is registered and cmesh is modified from another cmesh then the other cmesh's geometries are used. - -!!! note + t8_get_package_string() - If you need to use t8_cmesh_bcast, then all geometries must be registered *after* the bcast operation, not before. +Return the package string of t8code. This string has the format "t8 version\\_number". -# Arguments -* `cmesh`:\\[in,out\\] The cmesh. -* `geometry`:\\[in\\] The geometry to register. +# Returns +The version string of t8code. ### Prototype ```c -void t8_cmesh_register_geometry (t8_cmesh_t cmesh, t8_geometry_c *geometry); +const char* t8_get_package_string (); ``` """ -function t8_cmesh_register_geometry(cmesh, geometry) - @ccall libt8.t8_cmesh_register_geometry(cmesh::t8_cmesh_t, geometry::Ptr{t8_geometry_c})::Cvoid +function t8_get_package_string() + @ccall libt8.t8_get_package_string()::Cstring end +# no prototype is found for this function at t8_version.h:73:1, please use with caution """ - t8_cmesh_set_tree_geometry(cmesh, gtreeid, geom) + t8_get_version_number() -Set the geometry for a tree, thus specify which geometry to use for this tree. +Return the version number of t8code as a string. -# Arguments -* `cmesh`:\\[in\\] A non-committed cmesh. -* `gtreeid`:\\[in\\] A global tree id in *cmesh*. -* `geom`:\\[in\\] The geometry to use for this tree. See also t8_cmesh_get_tree_geometry +# Returns +The version number of t8code as a string. ### Prototype ```c -void t8_cmesh_set_tree_geometry (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const t8_geometry_c *geom); +const char* t8_get_version_number (); ``` """ -function t8_cmesh_set_tree_geometry(cmesh, gtreeid, geom) - @ccall libt8.t8_cmesh_set_tree_geometry(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t, geom::Ptr{t8_geometry_c})::Cvoid +function t8_get_version_number() + @ccall libt8.t8_get_version_number()::Cstring end +# no prototype is found for this function at t8_version.h:79:1, please use with caution """ - t8_cmesh_commit(cmesh, comm) + t8_get_version_point_string() + +Return the version point string. +# Returns +The version point point string. ### Prototype ```c -void t8_cmesh_commit (t8_cmesh_t cmesh, sc_MPI_Comm comm); +const char* t8_get_version_point_string (); ``` """ -function t8_cmesh_commit(cmesh, comm) - @ccall libt8.t8_cmesh_commit(cmesh::t8_cmesh_t, comm::MPI_Comm)::Cvoid +function t8_get_version_point_string() + @ccall libt8.t8_get_version_point_string()::Cstring end +# no prototype is found for this function at t8_version.h:85:1, please use with caution """ - t8_cmesh_save(cmesh, fileprefix) + t8_get_version_major() + +Return the major version number of t8code. +# Returns +The major version number of t8code. ### Prototype ```c -int t8_cmesh_save (t8_cmesh_t cmesh, const char *fileprefix); +int t8_get_version_major (); ``` """ -function t8_cmesh_save(cmesh, fileprefix) - @ccall libt8.t8_cmesh_save(cmesh::t8_cmesh_t, fileprefix::Cstring)::Cint +function t8_get_version_major() + @ccall libt8.t8_get_version_major()::Cint end +# no prototype is found for this function at t8_version.h:91:1, please use with caution """ - t8_cmesh_load(filename, comm) + t8_get_version_minor() + +Return the minor version number of t8code. +# Returns +The minor version number of t8code. ### Prototype ```c -t8_cmesh_t t8_cmesh_load (const char *filename, sc_MPI_Comm comm); +int t8_get_version_minor (); ``` """ -function t8_cmesh_load(filename, comm) - @ccall libt8.t8_cmesh_load(filename::Cstring, comm::MPI_Comm)::t8_cmesh_t +function t8_get_version_minor() + @ccall libt8.t8_get_version_minor()::Cint end +# no prototype is found for this function at t8_version.h:97:1, please use with caution """ - t8_load_mode + t8_get_version_patch() -This enumeration contains all modes in which we can open a saved cmesh. The cmesh can be loaded with more processes than it was saved and the mode controls, which of the processes open files and distribute the data. +Return the patch version number of t8code. -| Enumerator | Note | -| :----------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| T8\\_LOAD\\_SIMPLE | In simple mode, the first n processes load the file | -| T8\\_LOAD\\_BGQ | In BGQ mode, the file is loaded on n nodes and from one process of each node. This needs MPI Version 3.1 or higher. | -| T8\\_LOAD\\_STRIDE | Every n-th process loads a file. Handle with care, we introduce it, since on Juqueen MPI-3 was not available. The parameter n has to be passed as an extra parameter. # See also [`t8_cmesh_load_and_distribute`](@ref) | -| T8\\_LOAD\\_COUNT | | +# Returns +The patch version number of t8code. +### Prototype +```c +int t8_get_version_patch (); +``` """ -@cenum t8_load_mode::UInt32 begin - T8_LOAD_FIRST = 0 - T8_LOAD_SIMPLE = 0 - T8_LOAD_BGQ = 1 - T8_LOAD_STRIDE = 2 - T8_LOAD_COUNT = 3 +function t8_get_version_patch() + @ccall libt8.t8_get_version_patch()::Cint end -"""This enumeration contains all modes in which we can open a saved cmesh. The cmesh can be loaded with more processes than it was saved and the mode controls, which of the processes open files and distribute the data.""" -const t8_load_mode_t = t8_load_mode +@cenum t8_vtk_data_type_t::UInt32 begin + T8_VTK_SCALAR = 0 + T8_VTK_VECTOR = 1 +end """ - t8_cmesh_load_and_distribute(fileprefix, num_files, comm, mode, procs_per_node) + t8_vtk_data_field_t -### Prototype -```c -t8_cmesh_t t8_cmesh_load_and_distribute (const char *fileprefix, int num_files, sc_MPI_Comm comm, t8_load_mode_t mode, int procs_per_node); -``` +A data field for VTK output. This struct is used to store data that is written to the VTK files. It contains the type of the data, a description, and the actual data array. + +| Field | Note | +| :---------- | :----------------------------------------- | +| type | Describes of which type the data array is | +| description | String that describes the data. | """ -function t8_cmesh_load_and_distribute(fileprefix, num_files, comm, mode, procs_per_node) - @ccall libt8.t8_cmesh_load_and_distribute(fileprefix::Cstring, num_files::Cint, comm::MPI_Comm, mode::t8_load_mode_t, procs_per_node::Cint)::t8_cmesh_t +struct t8_vtk_data_field_t + type::t8_vtk_data_type_t + description::NTuple{8192, Cchar} + data::Ptr{Cdouble} end """ - t8_cmesh_comm_is_valid(cmesh, comm) + t8_write_pvtu(filename, num_procs, write_tree, write_rank, write_level, write_id, num_data, data) ### Prototype ```c -int t8_cmesh_comm_is_valid (t8_cmesh_t cmesh, sc_MPI_Comm comm); +int t8_write_pvtu (const char *filename, int num_procs, int write_tree, int write_rank, int write_level, int write_id, int num_data, t8_vtk_data_field_t *data); ``` """ -function t8_cmesh_comm_is_valid(cmesh, comm) - @ccall libt8.t8_cmesh_comm_is_valid(cmesh::t8_cmesh_t, comm::MPI_Comm)::Cint +function t8_write_pvtu(filename, num_procs, write_tree, write_rank, write_level, write_id, num_data, data) + @ccall libt8.t8_write_pvtu(filename::Cstring, num_procs::Cint, write_tree::Cint, write_rank::Cint, write_level::Cint, write_id::Cint, num_data::Cint, data::Ptr{t8_vtk_data_field_t})::Cint end """ - t8_cmesh_is_partitioned(cmesh) - -Query whether a committed cmesh is partitioned or replicated. + sc_shmem_malloc(package, elem_size, elem_count, comm) -# Arguments -* `cmesh`:\\[in\\] A committed cmesh. -# Returns -True if *cmesh* is partitioned. False otherwise. *cmesh* must be committed before calling this function. ### Prototype ```c -int t8_cmesh_is_partitioned (t8_cmesh_t cmesh); +void *sc_shmem_malloc (int package, size_t elem_size, size_t elem_count, sc_MPI_Comm comm); ``` """ -function t8_cmesh_is_partitioned(cmesh) - @ccall libt8.t8_cmesh_is_partitioned(cmesh::t8_cmesh_t)::Cint +function sc_shmem_malloc(package, elem_size, elem_count, comm) + @ccall libt8.sc_shmem_malloc(package::Cint, elem_size::Csize_t, elem_count::Csize_t, comm::Cint)::Ptr{Cvoid} end """ - t8_cmesh_get_dimension(cmesh) - -Get the dimension of a cmesh. + sc_shmem_free(package, array, comm) -# Arguments -* `cmesh`:\\[in\\] The cmesh. *cmesh* must be committed before calling this function. ### Prototype ```c -int t8_cmesh_get_dimension (const t8_cmesh_t cmesh); +void sc_shmem_free (int package, void *array, sc_MPI_Comm comm); ``` """ -function t8_cmesh_get_dimension(cmesh) - @ccall libt8.t8_cmesh_get_dimension(cmesh::t8_cmesh_t)::Cint +function sc_shmem_free(package, array, comm) + @ccall libt8.sc_shmem_free(package::Cint, array::Ptr{Cvoid}, comm::Cint)::Cvoid end """ - t8_cmesh_get_num_trees(cmesh) + sc_shmem_type_t -Return the global number of trees in a cmesh. +` sc_shmem.h ` + +| Enumerator | Note | +| :---------------------------- | :------------------------------------------- | +| SC\\_SHMEM\\_BASIC | use allgathers, then sum to simulate scan | +| SC\\_SHMEM\\_PRESCAN | mpi\\_scan, then allgather | +| SC\\_SHMEM\\_WINDOW | MPI\\_Win (requires MPI 3) | +| SC\\_SHMEM\\_WINDOW\\_PRESCAN | mpi\\_scan, then MPI\\_Win (requires MPI 3) | +""" +@cenum sc_shmem_type_t::UInt32 begin + SC_SHMEM_BASIC = 0 + SC_SHMEM_PRESCAN = 1 + SC_SHMEM_WINDOW = 2 + SC_SHMEM_WINDOW_PRESCAN = 3 + SC_SHMEM_NUM_TYPES = 4 + SC_SHMEM_NOT_SET = 5 +end + +""" + sc_shmem_set_type(comm, type) -# Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -# Returns -The number of trees associated to *cmesh*. *cmesh* must be committed before calling this function. ### Prototype ```c -t8_gloidx_t t8_cmesh_get_num_trees (t8_cmesh_t cmesh); +void sc_shmem_set_type (sc_MPI_Comm comm, sc_shmem_type_t type); ``` """ -function t8_cmesh_get_num_trees(cmesh) - @ccall libt8.t8_cmesh_get_num_trees(cmesh::t8_cmesh_t)::t8_gloidx_t +function sc_shmem_set_type(comm, type) + @ccall libt8.sc_shmem_set_type(comm::Cint, type::sc_shmem_type_t)::Cvoid end """ - t8_cmesh_get_num_local_trees(cmesh) - -Return the number of local trees of a cmesh. If the cmesh is not partitioned this is equivalent to t8_cmesh_get_num_trees. + sc_shmem_get_type(comm) -# Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -# Returns -The number of local trees of the cmesh. *cmesh* must be committed before calling this function. ### Prototype ```c -t8_locidx_t t8_cmesh_get_num_local_trees (t8_cmesh_t cmesh); +sc_shmem_type_t sc_shmem_get_type (sc_MPI_Comm comm); ``` """ -function t8_cmesh_get_num_local_trees(cmesh) - @ccall libt8.t8_cmesh_get_num_local_trees(cmesh::t8_cmesh_t)::t8_locidx_t +function sc_shmem_get_type(comm) + @ccall libt8.sc_shmem_get_type(comm::Cint)::sc_shmem_type_t end """ - t8_cmesh_get_num_ghosts(cmesh) - -Return the number of ghost trees of a cmesh. If the cmesh is not partitioned this is equivalent to t8_cmesh_get_num_trees. + sc_shmem_write_start(array, comm) -# Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -# Returns -The number of ghost trees of the cmesh. *cmesh* must be committed before calling this function. ### Prototype ```c -t8_locidx_t t8_cmesh_get_num_ghosts (t8_cmesh_t cmesh); +int sc_shmem_write_start (void *array, sc_MPI_Comm comm); ``` """ -function t8_cmesh_get_num_ghosts(cmesh) - @ccall libt8.t8_cmesh_get_num_ghosts(cmesh::t8_cmesh_t)::t8_locidx_t +function sc_shmem_write_start(array, comm) + @ccall libt8.sc_shmem_write_start(array::Ptr{Cvoid}, comm::Cint)::Cint end """ - t8_cmesh_get_first_treeid(cmesh) - -Return the global index of the first local tree of a cmesh. If the cmesh is not partitioned this is always 0. + sc_shmem_write_end(array, comm) -# Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -# Returns -The global id of the first local tree in cmesh. *cmesh* must be committed before calling this function. ### Prototype ```c -t8_gloidx_t t8_cmesh_get_first_treeid (t8_cmesh_t cmesh); +void sc_shmem_write_end (void *array, sc_MPI_Comm comm); ``` """ -function t8_cmesh_get_first_treeid(cmesh) - @ccall libt8.t8_cmesh_get_first_treeid(cmesh::t8_cmesh_t)::t8_gloidx_t +function sc_shmem_write_end(array, comm) + @ccall libt8.sc_shmem_write_end(array::Ptr{Cvoid}, comm::Cint)::Cvoid end """ - t8_cmesh_get_tree_geometry(cmesh, gtreeid) - -Get the geometry of a tree. + sc_shmem_memcpy(destarray, srcarray, bytes, comm) -# Arguments -* `cmesh`:\\[in\\] The cmesh. -* `gtreeid`:\\[in\\] The global tree id of the tree for which the geometry should be returned. -# Returns -The geometry of the tree. ### Prototype ```c -const t8_geometry_c * t8_cmesh_get_tree_geometry (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); +void sc_shmem_memcpy (void *destarray, void *srcarray, size_t bytes, sc_MPI_Comm comm); ``` """ -function t8_cmesh_get_tree_geometry(cmesh, gtreeid) - @ccall libt8.t8_cmesh_get_tree_geometry(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t)::Ptr{t8_geometry_c} +function sc_shmem_memcpy(destarray, srcarray, bytes, comm) + @ccall libt8.sc_shmem_memcpy(destarray::Ptr{Cvoid}, srcarray::Ptr{Cvoid}, bytes::Csize_t, comm::Cint)::Cvoid end """ - t8_cmesh_treeid_is_local_tree(cmesh, ltreeid) - -Query whether a given [`t8_locidx_t`](@ref) belongs to a local tree of a cmesh. + sc_shmem_allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm) -# Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -* `ltreeid`:\\[in\\] An (possible) tree index. -# Returns -True if *ltreeid* matches the range of local trees of *cmesh*. False if not. *cmesh* must be committed before calling this function. ### Prototype ```c -int t8_cmesh_treeid_is_local_tree (const t8_cmesh_t cmesh, const t8_locidx_t ltreeid); +void sc_shmem_allgather (void *sendbuf, int sendcount, sc_MPI_Datatype sendtype, void *recvbuf, int recvcount, sc_MPI_Datatype recvtype, sc_MPI_Comm comm); ``` """ -function t8_cmesh_treeid_is_local_tree(cmesh, ltreeid) - @ccall libt8.t8_cmesh_treeid_is_local_tree(cmesh::t8_cmesh_t, ltreeid::t8_locidx_t)::Cint +function sc_shmem_allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm) + @ccall libt8.sc_shmem_allgather(sendbuf::Ptr{Cvoid}, sendcount::Cint, sendtype::Cint, recvbuf::Ptr{Cvoid}, recvcount::Cint, recvtype::Cint, comm::Cint)::Cvoid end """ - t8_cmesh_treeid_is_ghost(cmesh, ltreeid) - -Query whether a given [`t8_locidx_t`](@ref) belongs to a ghost of a cmesh. + sc_shmem_prefix(sendbuf, recvbuf, count, type, op, comm) -# Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -* `ltreeid`:\\[in\\] An (possible) ghost index. -# Returns -True if *ltreeid* matches the range of ghost trees of *cmesh*. False if not. *cmesh* must be committed before calling this function. ### Prototype ```c -int t8_cmesh_treeid_is_ghost (const t8_cmesh_t cmesh, const t8_locidx_t ltreeid); +void sc_shmem_prefix (void *sendbuf, void *recvbuf, int count, sc_MPI_Datatype type, sc_MPI_Op op, sc_MPI_Comm comm); ``` """ -function t8_cmesh_treeid_is_ghost(cmesh, ltreeid) - @ccall libt8.t8_cmesh_treeid_is_ghost(cmesh::t8_cmesh_t, ltreeid::t8_locidx_t)::Cint +function sc_shmem_prefix(sendbuf, recvbuf, count, type, op, comm) + @ccall libt8.sc_shmem_prefix(sendbuf::Ptr{Cvoid}, recvbuf::Ptr{Cvoid}, count::Cint, type::Cint, op::Cint, comm::Cint)::Cvoid end +mutable struct t8_cmesh end + +"""Forward pointer reference to hidden cmesh implementation. This reference needs to be known by [`t8_geometry`](@ref), hence we put it before the include.""" +const t8_cmesh_t = Ptr{t8_cmesh} + +mutable struct t8_ctree end + +"""Forward pointer references to hidden implementations of tree.""" +const t8_ctree_t = Ptr{t8_ctree} + +mutable struct t8_cghost end + +"""Forward pointer references to hidden implementations of ghost tree.""" +const t8_cghost_t = Ptr{t8_cghost} + """ - t8_cmesh_ltreeid_to_ghostid(cmesh, ltreeid) + t8_cmesh_init(pcmesh) -Given a local tree id that belongs to a ghost, return the index of the ghost. +Create a new cmesh with reference count one. This cmesh needs to be specialized with the t8\\_cmesh\\_set\\_* calls. Then it needs to be set up with t8_cmesh_commit. # Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -* `ltreeid`:\\[in\\] The local id of a ghost, satisfying t8_cmesh_treeid_is_ghost, thus num\\_trees <= *ltreeid* < num\\_trees + num\\_ghosts -# Returns -The index of the ghost within all ghosts, thus an index 0 <= index < num\\_ghosts *cmesh* must be committed before calling this function. +* `pcmesh`:\\[in,out\\] On input, this pointer must be non-NULL. On return, this pointer set to the new cmesh. ### Prototype ```c -t8_locidx_t t8_cmesh_ltreeid_to_ghostid (const t8_cmesh_t cmesh, const t8_locidx_t ltreeid); +void t8_cmesh_init (t8_cmesh_t *pcmesh); ``` """ -function t8_cmesh_ltreeid_to_ghostid(cmesh, ltreeid) - @ccall libt8.t8_cmesh_ltreeid_to_ghostid(cmesh::t8_cmesh_t, ltreeid::t8_locidx_t)::t8_locidx_t +function t8_cmesh_init(pcmesh) + @ccall libt8.t8_cmesh_init(pcmesh::Ptr{t8_cmesh_t})::Cvoid end +# no prototype is found for this function at t8_cmesh.h:79:1, please use with caution """ - t8_cmesh_get_first_tree(cmesh) + t8_cmesh_new() -Return a pointer to the first local tree in a cmesh. +Allocate a new un-committed cmesh. -# Arguments -* `cmesh`:\\[in\\] The cmesh to be queried. # Returns -A pointer to the first local tree in *cmesh*. If *cmesh* has no local trees, NULL is returned. *cmesh* must be committed before calling this function. +A pointer to an un-committed [`t8_cmesh`](@ref) structure. ### Prototype ```c -t8_ctree_t t8_cmesh_get_first_tree (t8_cmesh_t cmesh); +t8_cmesh_t t8_cmesh_new (); ``` """ -function t8_cmesh_get_first_tree(cmesh) - @ccall libt8.t8_cmesh_get_first_tree(cmesh::t8_cmesh_t)::t8_ctree_t +function t8_cmesh_new() + @ccall libt8.t8_cmesh_new()::t8_cmesh_t end """ - t8_cmesh_get_next_tree(cmesh, tree) + t8_cmesh_is_initialized(cmesh) -Given a local tree in a cmesh return a pointer to the next local tree. +Check whether a cmesh is not NULL, initialized and not committed. In addition, it asserts that the cmesh is consistent as much as possible. # Arguments -* `cmesh`:\\[in\\] The cmesh to be queried. -* `tree`:\\[in\\] A local tree in *cmesh*. +* `cmesh`:\\[in\\] This cmesh is examined. May be NULL. # Returns -A pointer to the next local tree in *cmesh* after *tree*. If no such tree exists, NULL is returned. * *cmesh* must be committed before calling this function. TODO: If we run over tree numbers only, don't use ctree\\_t in API if possible. +True if cmesh is not NULL, t8_cmesh_init has been called on it, but not t8_cmesh_commit. False otherwise. ### Prototype ```c -t8_ctree_t t8_cmesh_get_next_tree (t8_cmesh_t cmesh, t8_ctree_t tree); +int t8_cmesh_is_initialized (t8_cmesh_t cmesh); ``` """ -function t8_cmesh_get_next_tree(cmesh, tree) - @ccall libt8.t8_cmesh_get_next_tree(cmesh::t8_cmesh_t, tree::t8_ctree_t)::t8_ctree_t +function t8_cmesh_is_initialized(cmesh) + @ccall libt8.t8_cmesh_is_initialized(cmesh::t8_cmesh_t)::Cint end """ - t8_cmesh_get_tree(cmesh, ltree_id) + t8_cmesh_is_committed(cmesh) -Return a pointer to a given local tree. +Check whether a cmesh is not NULL, initialized and committed. In addition, it asserts that the cmesh is consistent as much as possible. # Arguments -* `cmesh`:\\[in\\] The cmesh to be queried. -* `ltree_id`:\\[in\\] The local id of the tree that is asked for. +* `cmesh`:\\[in\\] This cmesh is examined. May be NULL. # Returns -A pointer to tree in *cmesh* with local id *ltree_id*. The cmesh must have at least *ltree_id* + 1 local trees when calling this function. *cmesh* must be committed before calling this function. +True if cmesh is not NULL and t8_cmesh_init has been called on it as well as t8_cmesh_commit. False otherwise. ### Prototype ```c -t8_ctree_t t8_cmesh_get_tree (t8_cmesh_t cmesh, t8_locidx_t ltree_id); +int t8_cmesh_is_committed (const t8_cmesh_t cmesh); ``` """ -function t8_cmesh_get_tree(cmesh, ltree_id) - @ccall libt8.t8_cmesh_get_tree(cmesh::t8_cmesh_t, ltree_id::t8_locidx_t)::t8_ctree_t +function t8_cmesh_is_committed(cmesh) + @ccall libt8.t8_cmesh_is_committed(cmesh::t8_cmesh_t)::Cint end """ - t8_cmesh_get_tree_class(cmesh, ltree_id) + t8_cmesh_disable_negative_volume_check(cmesh) -Return the eclass of a given local tree. TODO: Should we refer to indices or consequently use ctree\\_t? +Disable the debug check for negative volumes in trees during t8_cmesh_commit. Does nothing outside of debug mode. # Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -* `tree_id`:\\[in\\] The local id of the tree whose eclass will be returned. -# Returns -The eclass of the given tree. TODO: Call tree ids ltree\\_id or gtree\\_id etc. instead of tree\\_id. *cmesh* must be committed before calling this function. +* `cmesh`:\\[in,out\\] ### Prototype ```c -t8_eclass_t t8_cmesh_get_tree_class (t8_cmesh_t cmesh, t8_locidx_t ltree_id); +void t8_cmesh_disable_negative_volume_check (t8_cmesh_t cmesh); ``` """ -function t8_cmesh_get_tree_class(cmesh, ltree_id) - @ccall libt8.t8_cmesh_get_tree_class(cmesh::t8_cmesh_t, ltree_id::t8_locidx_t)::t8_eclass_t +function t8_cmesh_disable_negative_volume_check(cmesh) + @ccall libt8.t8_cmesh_disable_negative_volume_check(cmesh::t8_cmesh_t)::Cvoid end """ - t8_cmesh_tree_face_is_boundary(cmesh, ltree_id, face) + t8_cmesh_set_derive(cmesh, set_from) -Query whether a face of a local tree or ghost is at the domain boundary. +This function sets a cmesh to be derived from. The default is to create a cmesh standalone by specifying all data manually. A coarse mesh can also be constructed by deriving it from an existing one. The derivation from another cmesh may optionally be combined with a repartition or uniform refinement of each tree. This function overrides a previously set cmesh to be derived from. # Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -* `ltree_id`:\\[in\\] The local id of a tree. -* `face`:\\[in\\] The number of a face of the tree. -# Returns -True if the face is at the domain boundary. False otherwise. *cmesh* must be committed before calling this function. +* `cmesh`:\\[in,out\\] Must be initialized, but not committed. May even be NULL to revert to standalone. +* `set_from`:\\[in,out\\] Reference counter on this cmesh is bumped. It will be unbumped by t8_cmesh_commit, after which *from* is no longer remembered. Other than that the from object is not changed. ### Prototype ```c -int t8_cmesh_tree_face_is_boundary (t8_cmesh_t cmesh, t8_locidx_t ltree_id, int face); +void t8_cmesh_set_derive (t8_cmesh_t cmesh, t8_cmesh_t set_from); ``` """ -function t8_cmesh_tree_face_is_boundary(cmesh, ltree_id, face) - @ccall libt8.t8_cmesh_tree_face_is_boundary(cmesh::t8_cmesh_t, ltree_id::t8_locidx_t, face::Cint)::Cint +function t8_cmesh_set_derive(cmesh, set_from) + @ccall libt8.t8_cmesh_set_derive(cmesh::t8_cmesh_t, set_from::t8_cmesh_t)::Cvoid end -""" - t8_cmesh_get_ghost_class(cmesh, lghost_id) +mutable struct t8_shmem_array end -Return the eclass of a given local ghost. TODO: Should we refer to indices or consequently use cghost\\_t? +const t8_shmem_array_t = Ptr{t8_shmem_array} + +""" + t8_cmesh_alloc_offsets(mpisize, comm) -# Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -* `ghost_id`:\\[in\\] The local id of the ghost whose eclass will be returned. 0 <= *tree_id* < cmesh.num\\_ghosts. -# Returns -The eclass of the given ghost. *cmesh* must be committed before calling this function. ### Prototype ```c -t8_eclass_t t8_cmesh_get_ghost_class (t8_cmesh_t cmesh, t8_locidx_t lghost_id); +t8_shmem_array_t t8_cmesh_alloc_offsets (int mpisize, sc_MPI_Comm comm); ``` """ -function t8_cmesh_get_ghost_class(cmesh, lghost_id) - @ccall libt8.t8_cmesh_get_ghost_class(cmesh::t8_cmesh_t, lghost_id::t8_locidx_t)::t8_eclass_t +function t8_cmesh_alloc_offsets(mpisize, comm) + @ccall libt8.t8_cmesh_alloc_offsets(mpisize::Cint, comm::Cint)::t8_shmem_array_t end """ - t8_cmesh_get_global_id(cmesh, local_id) + t8_cmesh_set_partition_range(cmesh, set_face_knowledge, first_local_tree, last_local_tree) -Return the global id of a given local tree or ghost. +Declare if the cmesh is understood as a partitioned cmesh and specify the processor local tree range. This function should be preferred over t8_cmesh_set_partition_offsets when the cmesh is not derived from another cmesh. This call is only valid when the cmesh is not yet committed via a call to t8_cmesh_commit. + +!!! note + + A value of *set_face_knowledge* other than -1 or 3 is not yet supported. # Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -* `local_id`:\\[in\\] The local id of a tree or a ghost. If *local_id* < cmesh.num\\_local\\_trees then it is a tree, otherwise a ghost. -# Returns -The global id of the tree/ghost. +* `cmesh`:\\[in,out\\] The cmesh to be updated. +* `set_face_knowledge`:\\[in\\] Several values are possible that define how much information is required on face connections, specified by t8_cmesh_set_join. 0: Expect face connection of local trees. 1: In addition, expect face connection from ghost trees to local trees. 2: In addition, expect face connection between ghost trees. 3: Expect face connection of local and ghost trees. Consistency of this requirement is checked on t8_cmesh_commit. -1: Do not change the face\\_knowledge level but keep any previously set ones. (Possibly by a previous call to t8_cmesh_set_partition_range) +* `first_local_tree`:\\[in\\] The global index ID of the first tree on this process. If this tree is also the last tree on the previous process, then the argument must be -ID - 1. +* `last_local_tree`:\\[in\\] The global index of the last tree on this process. If this process should be empty then *last_local_tree* must be strictly smaller than *first_local_tree*. # See also -https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. +t8\\_cmesh\\_set\\_partition\\_offset, [`t8_cmesh_set_partition_uniform`](@ref) ### Prototype ```c -t8_gloidx_t t8_cmesh_get_global_id (t8_cmesh_t cmesh, t8_locidx_t local_id); +void t8_cmesh_set_partition_range (t8_cmesh_t cmesh, int set_face_knowledge, t8_gloidx_t first_local_tree, t8_gloidx_t last_local_tree); ``` """ -function t8_cmesh_get_global_id(cmesh, local_id) - @ccall libt8.t8_cmesh_get_global_id(cmesh::t8_cmesh_t, local_id::t8_locidx_t)::t8_gloidx_t +function t8_cmesh_set_partition_range(cmesh, set_face_knowledge, first_local_tree, last_local_tree) + @ccall libt8.t8_cmesh_set_partition_range(cmesh::t8_cmesh_t, set_face_knowledge::Cint, first_local_tree::t8_gloidx_t, last_local_tree::t8_gloidx_t)::Cvoid end """ - t8_cmesh_get_local_id(cmesh, global_id) + t8_cmesh_set_partition_offsets(cmesh, tree_offsets) -Return the local id of a give global tree. +Declare if the cmesh is understood as a partitioned cmesh and specify the first local tree for each process. This call is only valid when the cmesh is not yet committed via a call to t8_cmesh_commit. If instead t8_cmesh_set_partition_range was called and the cmesh is derived then the offset array is constructed during commit. # Arguments -* `cmesh`:\\[in\\] The cmesh. -* `global_id`:\\[in\\] A global tree id. -# Returns -Either a value l 0 <= *l* < num\\_local\\_trees if *global_id* corresponds to a local tree, or num\\_local\\_trees <= *l* < num\\_local\\_trees + num\\_ghosts if *global_id* corresponds to a ghost trees, or negative if *global_id* neither matches a local nor a ghost tree. -# See also -https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. - +* `cmesh`:\\[in,out\\] The cmesh to be updated. +* `tree_offsets`:\\[in\\] An array of global tree\\_id offsets for each process can be specified here. TODO: document flag for shared trees. ### Prototype ```c -t8_locidx_t t8_cmesh_get_local_id (t8_cmesh_t cmesh, t8_gloidx_t global_id); +void t8_cmesh_set_partition_offsets (t8_cmesh_t cmesh, t8_shmem_array_t tree_offsets); ``` """ -function t8_cmesh_get_local_id(cmesh, global_id) - @ccall libt8.t8_cmesh_get_local_id(cmesh::t8_cmesh_t, global_id::t8_gloidx_t)::t8_locidx_t +function t8_cmesh_set_partition_offsets(cmesh, tree_offsets) + @ccall libt8.t8_cmesh_set_partition_offsets(cmesh::t8_cmesh_t, tree_offsets::t8_shmem_array_t)::Cvoid end -""" - t8_cmesh_get_face_neighbor(cmesh, ltreeid, face, dual_face, orientation) +mutable struct t8_scheme end -Given a local tree id and a face number, get information about the face neighbor tree. +"""The scheme holds implementations for one or more element classes. Opaque pointer for C interface. Detailed documentation at t8_scheme.""" +const t8_scheme_c = t8_scheme -!!! note +""" + t8_cmesh_set_partition_uniform(cmesh, element_level, scheme) - If *ltreeid* is a ghost and it has a neighbor which is neither a local tree or ghost, then the return value will be negative. Thus, a negative return value does not necessarily mean that this is a domain boundary. To find out whether a tree is a domain boundary or not +Declare if a derived cmesh should be partitioned according to a uniform refinement of a given level for the provided scheme. This call is only valid when the cmesh is not yet committed via a call to t8_cmesh_commit and when the cmesh will be derived. # Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -* `ltreeid`:\\[in\\] The local id of a tree or a ghost. -* `face`:\\[in\\] A face number of the tree/ghost. -* `dual_face`:\\[out\\] If not NULL, the face number of the neighbor tree at this connection. -* `orientation`:\\[out\\] If not NULL, the face orientation of the connection. -# Returns -If non-negative: The local id of the neighbor tree or ghost. If negative: There is no neighbor across this face. *dual_face* and *orientation* remain unchanged. -# See also -[`t8_cmesh_tree_face_is_boundary`](@ref). - +* `cmesh`:\\[in,out\\] The cmesh to be updated. +* `element_level`:\\[in\\] The refinement\\_level. +* `scheme`:\\[in\\] The element scheme describing the refinement pattern. We take ownership. This can be prevented by referencing **scheme** before calling this function. ### Prototype ```c -t8_locidx_t t8_cmesh_get_face_neighbor (const t8_cmesh_t cmesh, const t8_locidx_t ltreeid, const int face, int *dual_face, int *orientation); +void t8_cmesh_set_partition_uniform (t8_cmesh_t cmesh, const int element_level, const t8_scheme_c *scheme); ``` """ -function t8_cmesh_get_face_neighbor(cmesh, ltreeid, face, dual_face, orientation) - @ccall libt8.t8_cmesh_get_face_neighbor(cmesh::t8_cmesh_t, ltreeid::t8_locidx_t, face::Cint, dual_face::Ptr{Cint}, orientation::Ptr{Cint})::t8_locidx_t +function t8_cmesh_set_partition_uniform(cmesh, element_level, scheme) + @ccall libt8.t8_cmesh_set_partition_uniform(cmesh::t8_cmesh_t, element_level::Cint, scheme::Ptr{t8_scheme_c})::Cvoid end """ - t8_cmesh_print_profile(cmesh) + t8_cmesh_set_refine(cmesh, level, scheme) -Print the collected statistics from a cmesh profile. +Refine the cmesh to a given level. Thus split each tree into x^level subtrees TODO: implement -*cmesh* must be committed before calling this function. +### Prototype +```c +void t8_cmesh_set_refine (t8_cmesh_t cmesh, const int level, const t8_scheme_c *scheme); +``` +""" +function t8_cmesh_set_refine(cmesh, level, scheme) + @ccall libt8.t8_cmesh_set_refine(cmesh::t8_cmesh_t, level::Cint, scheme::Ptr{t8_scheme_c})::Cvoid +end -# Arguments -* `cmesh`:\\[in\\] The cmesh. -# See also -[`t8_cmesh_set_profiling`](@ref) +""" + t8_cmesh_set_dimension(cmesh, dim) + +Set the dimension of a cmesh. If any tree is inserted to the cmesh via [`t8_cmesh_set_tree_class`](@ref), then the dimension is set automatically to that of the inserted tree. However, if the cmesh is constructed partitioned and the part on this process is empty, it is necessary to set the dimension by hand. +# Arguments +* `cmesh`:\\[in,out\\] The cmesh to be updated. +* `dim`:\\[in\\] The dimension to be set. Must satisfy 0 <= dim <= 3. The cmesh must not be committed before calling this function. ### Prototype ```c -void t8_cmesh_print_profile (t8_cmesh_t cmesh); +void t8_cmesh_set_dimension (t8_cmesh_t cmesh, int dim); ``` """ -function t8_cmesh_print_profile(cmesh) - @ccall libt8.t8_cmesh_print_profile(cmesh::t8_cmesh_t)::Cvoid +function t8_cmesh_set_dimension(cmesh, dim) + @ccall libt8.t8_cmesh_set_dimension(cmesh::t8_cmesh_t, dim::Cint)::Cvoid end """ - t8_cmesh_get_tree_vertices(cmesh, ltreeid) + t8_cmesh_set_tree_class(cmesh, gtree_id, tree_class) -Return a pointer to the vertex coordinates of a tree. +Set the class of a tree in the cmesh. It is not allowed to call this function after t8_cmesh_commit. It is not allowed to call this function multiple times for the same tree. # Arguments -* `cmesh`:\\[in\\] The cmesh. -* `ltreeid`:\\[in\\] The id of a local tree. -# Returns -If stored, a pointer to the vertex coordinates of *tree*. If no coordinates for this tree are found, NULL. +* `cmesh`:\\[in,out\\] The cmesh to be updated. +* `gtree_id`:\\[in\\] The global number of the tree. +* `tree_class`:\\[in\\] The element class of this tree. ### Prototype ```c -double * t8_cmesh_get_tree_vertices (t8_cmesh_t cmesh, t8_locidx_t ltreeid); +void t8_cmesh_set_tree_class (t8_cmesh_t cmesh, t8_gloidx_t gtree_id, t8_eclass_t tree_class); ``` """ -function t8_cmesh_get_tree_vertices(cmesh, ltreeid) - @ccall libt8.t8_cmesh_get_tree_vertices(cmesh::t8_cmesh_t, ltreeid::t8_locidx_t)::Ptr{Cdouble} +function t8_cmesh_set_tree_class(cmesh, gtree_id, tree_class) + @ccall libt8.t8_cmesh_set_tree_class(cmesh::t8_cmesh_t, gtree_id::t8_gloidx_t, tree_class::t8_eclass_t)::Cvoid end """ - t8_cmesh_get_attribute(cmesh, package_id, key, ltree_id) + t8_cmesh_set_attribute(cmesh, gtree_id, package_id, key, data, data_size, data_persists) -Return the attribute pointer of a tree. +Store an attribute at a tree in a cmesh. Attributes can be arbitrary data that is copied to an internal storage associated to the tree. Each application can set multiple attributes and attributes are distinguished by an integer key, where each application can use any integer as key. !!! note - *cmesh* must be committed before calling this function. + If an attribute with the given package\\_id and key already exists, then it will get overwritten. # Arguments -* `cmesh`:\\[in\\] The cmesh. -* `package_id`:\\[in\\] The identifier of a valid software package. -* `key`:\\[in\\] A key used to identify the attribute under all attributes of this tree with the same *package_id*. -* `tree_id`:\\[in\\] The local number of the tree. -# Returns -The attribute pointer of the tree *ltree_id* or NULL if the attribute is not found. +* `cmesh`:\\[in,out\\] The cmesh to be updated. +* `gtree_id`:\\[in\\] The global id of the tree. +* `package_id`:\\[in\\] Unique identifier of a valid software package. +* `key`:\\[in\\] An integer key used to identify this attribute under all attributes with the same package\\_id. *key* must be a unique value for this tree and package\\_id. +* `data`:\\[in\\] A pointer to the attribute data. +* `data_size`:\\[in\\] The number of bytes of the attribute. +* `data_persists`:\\[in\\] This flag can be used to optimize memory. If true then t8code assumes that the attribute data is present at the memory that *data* points to when t8_cmesh_commit is called (This is more memory efficient). If the flag is false an internal copy of the data is created immediately and this copy is used at commit. In both cases a copy of the data is used by t8\\_code after [`t8_cmesh_commit`](@ref). # See also -[`sc_package_register`](@ref), [`t8_cmesh_set_attribute`](@ref) +[`sc_package_register`](@ref) ### Prototype ```c -void * t8_cmesh_get_attribute (const t8_cmesh_t cmesh, const int package_id, const int key, const t8_locidx_t ltree_id); +void t8_cmesh_set_attribute (t8_cmesh_t cmesh, t8_gloidx_t gtree_id, int package_id, int key, void *data, size_t data_size, int data_persists); ``` """ -function t8_cmesh_get_attribute(cmesh, package_id, key, ltree_id) - @ccall libt8.t8_cmesh_get_attribute(cmesh::t8_cmesh_t, package_id::Cint, key::Cint, ltree_id::t8_locidx_t)::Ptr{Cvoid} +function t8_cmesh_set_attribute(cmesh, gtree_id, package_id, key, data, data_size, data_persists) + @ccall libt8.t8_cmesh_set_attribute(cmesh::t8_cmesh_t, gtree_id::t8_gloidx_t, package_id::Cint, key::Cint, data::Ptr{Cvoid}, data_size::Csize_t, data_persists::Cint)::Cvoid end """ - t8_cmesh_get_attribute_gloidx_array(cmesh, package_id, key, ltree_id, data_count) + t8_cmesh_set_attribute_string(cmesh, gtree_id, package_id, key, string) -Return the attribute pointer of a tree for a gloidx\\_t array. +Store a string as an attribute at a tree in a cmesh. !!! note - *cmesh* must be committed before calling this function. + You can also use t8_cmesh_set_attribute, but we recommend using this specialized function for strings. !!! note - No check is performed whether the attribute actually stored *data_count* many entries since we do not store the number of data entries of the attribute array. You can keep track of the data count yourself by using another attribute. + If an attribute with the given package\\_id and key already exists, then it will get overwritten. # Arguments -* `cmesh`:\\[in\\] The cmesh. -* `package_id`:\\[in\\] The identifier of a valid software package. -* `key`:\\[in\\] A key used to identify the attribute under all attributes of this tree with the same *package_id*. -* `ltree_id`:\\[in\\] The local number of the tree. -* `data_count`:\\[in\\] The number of entries in the array that are requested. This must be smaller or equal to the *data_count* parameter of the corresponding call to t8_cmesh_set_attribute_gloidx_array -# Returns -The attribute pointer of the tree *ltree_id* or NULL if the attribute is not found. +* `cmesh`:\\[in,out\\] The cmesh to be updated. +* `gtree_id`:\\[in\\] The global id of the tree. +* `package_id`:\\[in\\] Unique identifier of a valid software package. +* `key`:\\[in\\] An integer key used to identify this attribute under all attributes with the same package\\_id. *key* must be a unique value for this tree and package\\_id. +* `string`:\\[in\\] The string to store as attribute. # See also -[`sc_package_register`](@ref), [`t8_cmesh_set_attribute_gloidx_array`](@ref) +[`sc_package_register`](@ref) ### Prototype ```c -t8_gloidx_t * t8_cmesh_get_attribute_gloidx_array (const t8_cmesh_t cmesh, const int package_id, const int key, const t8_locidx_t ltree_id, const size_t data_count); +void t8_cmesh_set_attribute_string (t8_cmesh_t cmesh, t8_gloidx_t gtree_id, int package_id, int key, const char *string); ``` """ -function t8_cmesh_get_attribute_gloidx_array(cmesh, package_id, key, ltree_id, data_count) - @ccall libt8.t8_cmesh_get_attribute_gloidx_array(cmesh::t8_cmesh_t, package_id::Cint, key::Cint, ltree_id::t8_locidx_t, data_count::Csize_t)::Ptr{t8_gloidx_t} +function t8_cmesh_set_attribute_string(cmesh, gtree_id, package_id, key, string) + @ccall libt8.t8_cmesh_set_attribute_string(cmesh::t8_cmesh_t, gtree_id::t8_gloidx_t, package_id::Cint, key::Cint, string::Cstring)::Cvoid end """ - t8_cmesh_get_partition_table(cmesh) + t8_cmesh_set_attribute_gloidx_array(cmesh, gtree_id, package_id, key, data, data_count, data_persists) -Return the shared memory array storing the partition table of a partitioned cmesh. +Store an array of [`t8_gloidx_t`](@ref) as an attribute at a tree in a cmesh. + +!!! note + + You can also use t8_cmesh_set_attribute, but we recommend using this specialized function for arrays. + +!!! note + + If an attribute with the given package\\_id and key already exists, then it will get overwritten. + +!!! note + + We do not store the number of data entries *data_count* of the attribute array. You can keep track of the data count yourself by using another attribute. # Arguments -* `cmesh`:\\[in\\] The cmesh. -# Returns -The partition array. NULL if the cmesh is not partitioned or the partition array is not stored in *cmesh*. *cmesh* must be committed before calling this function. +* `cmesh`:\\[in,out\\] The cmesh to be updated. +* `gtree_id`:\\[in\\] The global id of the tree. +* `package_id`:\\[in\\] Unique identifier of a valid software package. +* `key`:\\[in\\] An integer key used to identify this attribute under all attributes with the same package\\_id. *key* must be a unique value for this tree and package\\_id. +* `data`:\\[in\\] The array to store as attribute. +* `data_count`:\\[in\\] The number of entries in *data*. +* `data_persists`:\\[in\\] This flag can be used to optimize memory. If true then t8code assumes that the attribute data is present at the memory that *data* points to when t8_cmesh_commit is called (This is more memory efficient). If the flag is false an internal copy of the data is created immediately and this copy is used at commit. In both cases a copy of the data is used by t8\\_code after [`t8_cmesh_commit`](@ref). +# See also +[`sc_package_register`](@ref) + ### Prototype ```c -t8_shmem_array_t t8_cmesh_get_partition_table (t8_cmesh_t cmesh); +void t8_cmesh_set_attribute_gloidx_array (t8_cmesh_t cmesh, t8_gloidx_t gtree_id, int package_id, int key, const t8_gloidx_t *data, const size_t data_count, int data_persists); ``` """ -function t8_cmesh_get_partition_table(cmesh) - @ccall libt8.t8_cmesh_get_partition_table(cmesh::t8_cmesh_t)::t8_shmem_array_t +function t8_cmesh_set_attribute_gloidx_array(cmesh, gtree_id, package_id, key, data, data_count, data_persists) + @ccall libt8.t8_cmesh_set_attribute_gloidx_array(cmesh::t8_cmesh_t, gtree_id::t8_gloidx_t, package_id::Cint, key::Cint, data::Ptr{t8_gloidx_t}, data_count::Csize_t, data_persists::Cint)::Cvoid end """ - t8_cmesh_uniform_bounds(cmesh, level, ts, first_local_tree, child_in_tree_begin, last_local_tree, child_in_tree_end, first_tree_shared) + t8_cmesh_set_join(cmesh, gtree1, gtree2, face1, face2, orientation) -Calculate the section of a uniform forest for the current rank. +Insert a face-connection between two trees in a cmesh. + +!!! note + + The orientation is defined as: Let my\\_face and other\\_face be the two face numbers of the connecting trees. We chose a main\\_face from them as follows: Either both trees have the same element class, then the face with the lower face number is the main\\_face or the trees belong to different classes in which case the face belonging to the tree with the lower class according to the ordering triangle < quad, hex < tet < prism < pyramid, is the main\\_face. Then face corner 0 of the main\\_face connects to a face corner k in the other face. The face orientation is defined as the number k. If the classes are equal and my\\_face == other\\_face, treating either of both faces as the main\\_face leads to the same result. See https://arxiv.org/pdf/1611.02929.pdf for more details. # Arguments -* `cmesh`:\\[in\\] The cmesh to be considered. -* `level`:\\[in\\] The uniform refinement level to be created. -* `ts`:\\[in\\] The element scheme for which to compute the bounds. -* `first_local_tree`:\\[out\\] The first tree that contains elements belonging to the calling processor. -* `child_in_tree_begin`:\\[out\\] The global index of the first element belonging to the calling processor. Not computed if NULL. -* `last_local_tree`:\\[out\\] The last tree that contains elements belonging to the calling processor. -* `child_in_tree_end`:\\[out\\] The global index of the first element that does not belonging to the calling processor anymore. Not computed if NULL. -* `first_tree_shared`:\\[out\\] If not NULL, 1 or 0 is stored here depending on whether *first_local_tree* is the same as *last_local_tree* on the next process. *cmesh* must be committed before calling this function. * +* `cmesh`:\\[in,out\\] The cmesh to be updated. +* `gtree1`:\\[in\\] The tree id of the first of the two trees. +* `gtree2`:\\[in\\] The tree id of the second of the two trees. +* `face1`:\\[in\\] The face number of the first tree. +* `face2`:\\[in\\] The face number of the second tree. +* `orientation`:\\[in\\] Specify how face1 and face2 are oriented to each other ### Prototype ```c -void t8_cmesh_uniform_bounds (t8_cmesh_t cmesh, int level, const t8_scheme_cxx_t *ts, t8_gloidx_t *first_local_tree, t8_gloidx_t *child_in_tree_begin, t8_gloidx_t *last_local_tree, t8_gloidx_t *child_in_tree_end, int8_t *first_tree_shared); +void t8_cmesh_set_join (t8_cmesh_t cmesh, t8_gloidx_t gtree1, t8_gloidx_t gtree2, int face1, int face2, int orientation); ``` """ -function t8_cmesh_uniform_bounds(cmesh, level, ts, first_local_tree, child_in_tree_begin, last_local_tree, child_in_tree_end, first_tree_shared) - @ccall libt8.t8_cmesh_uniform_bounds(cmesh::t8_cmesh_t, level::Cint, ts::Ptr{t8_scheme_cxx_t}, first_local_tree::Ptr{t8_gloidx_t}, child_in_tree_begin::Ptr{t8_gloidx_t}, last_local_tree::Ptr{t8_gloidx_t}, child_in_tree_end::Ptr{t8_gloidx_t}, first_tree_shared::Ptr{Int8})::Cvoid +function t8_cmesh_set_join(cmesh, gtree1, gtree2, face1, face2, orientation) + @ccall libt8.t8_cmesh_set_join(cmesh::t8_cmesh_t, gtree1::t8_gloidx_t, gtree2::t8_gloidx_t, face1::Cint, face2::Cint, orientation::Cint)::Cvoid end """ - t8_cmesh_ref(cmesh) + t8_cmesh_set_profiling(cmesh, set_profiling) -Increase the reference counter of a cmesh. +Enable or disable profiling for a cmesh. If profiling is enabled, runtimes and statistics are collected during cmesh\\_commit. + +Profiling is disabled by default. The cmesh must not be committed before calling this function. # Arguments -* `cmesh`:\\[in,out\\] On input, this cmesh must exist with positive reference count. It may be in any state. +* `cmesh`:\\[in,out\\] The cmesh to be updated. +* `set_profiling`:\\[in\\] If true, profiling will be enabled, if false disabled. +# See also +[`t8_cmesh_print_profile`](@ref) + ### Prototype ```c -void t8_cmesh_ref (t8_cmesh_t cmesh); +void t8_cmesh_set_profiling (t8_cmesh_t cmesh, int set_profiling); ``` """ -function t8_cmesh_ref(cmesh) - @ccall libt8.t8_cmesh_ref(cmesh::t8_cmesh_t)::Cvoid +function t8_cmesh_set_profiling(cmesh, set_profiling) + @ccall libt8.t8_cmesh_set_profiling(cmesh::t8_cmesh_t, set_profiling::Cint)::Cvoid end """ - t8_cmesh_unref(pcmesh) + t8_cmesh_is_equal(cmesh_a, cmesh_b) -Decrease the reference counter of a cmesh. If the counter reaches zero, this cmesh is destroyed. See also t8_cmesh_destroy, which is to be preferred when it is known that the last reference to a cmesh is deleted. +Check whether two given cmeshes carry the same information. # Arguments -* `pcmesh`:\\[in,out\\] On input, the cmesh pointed to must exist with positive reference count. It may be in any state. If the reference count reaches zero, the cmesh is destroyed and this pointer set to NULL. Otherwise, the pointer is not changed and the cmesh is not modified in other ways. +* `cmesh_a`:\\[in\\] The first of the two cmeshes to be checked. +* `cmesh_b`:\\[in\\] The second of the two cmeshes to be checked. +# Returns +True if both cmeshes carry the same information, false otherwise. TODO: define carefully. Orders, sequences, equivalences? This function works on committed and uncommitted cmeshes. ### Prototype ```c -void t8_cmesh_unref (t8_cmesh_t *pcmesh); +int t8_cmesh_is_equal (t8_cmesh_t cmesh_a, t8_cmesh_t cmesh_b); ``` """ -function t8_cmesh_unref(pcmesh) - @ccall libt8.t8_cmesh_unref(pcmesh::Ptr{t8_cmesh_t})::Cvoid +function t8_cmesh_is_equal(cmesh_a, cmesh_b) + @ccall libt8.t8_cmesh_is_equal(cmesh_a::t8_cmesh_t, cmesh_b::t8_cmesh_t)::Cint end """ - t8_cmesh_destroy(pcmesh) + t8_cmesh_is_empty(cmesh) -Verify that a coarse mesh has only one reference left and destroy it. This function is preferred over t8_cmesh_unref when it is known that the last reference is to be deleted. +Check whether a cmesh is empty on all processes. # Arguments -* `pcmesh`:\\[in,out\\] This cmesh must have a reference count of one. It can be in any state (committed or not). Then it effectively calls t8_cmesh_unref. -* `comm`:\\[in\\] A mpi communicator that is valid with *cmesh*. +* `cmesh`:\\[in\\] A committed cmesh. +# Returns +True (non-zero) if and only if the cmesh has trees at all. ### Prototype ```c -void t8_cmesh_destroy (t8_cmesh_t *pcmesh); +int t8_cmesh_is_empty (t8_cmesh_t cmesh); ``` """ -function t8_cmesh_destroy(pcmesh) - @ccall libt8.t8_cmesh_destroy(pcmesh::Ptr{t8_cmesh_t})::Cvoid +function t8_cmesh_is_empty(cmesh) + @ccall libt8.t8_cmesh_is_empty(cmesh::t8_cmesh_t)::Cint end """ - t8_cmesh_new_testhybrid(comm) + t8_cmesh_bcast(cmesh_in, root, comm) ### Prototype ```c -t8_cmesh_t t8_cmesh_new_testhybrid (sc_MPI_Comm comm); +t8_cmesh_t t8_cmesh_bcast (t8_cmesh_t cmesh_in, int root, sc_MPI_Comm comm); ``` """ -function t8_cmesh_new_testhybrid(comm) - @ccall libt8.t8_cmesh_new_testhybrid(comm::MPI_Comm)::t8_cmesh_t +function t8_cmesh_bcast(cmesh_in, root, comm) + @ccall libt8.t8_cmesh_bcast(cmesh_in::t8_cmesh_t, root::Cint, comm::Cint)::t8_cmesh_t end -""" - t8_cmesh_coords_axb(coords_in, coords_out, num_vertices, alpha, b) +mutable struct t8_geometry end -Compute y = ax + b on an array of doubles, interpreting each 3 as one vector x +"""This typedef holds virtual functions for a particular geometry. We need it so that we can use [`t8_geometry_c`](@ref) pointers in .c files without them seeing the actual C++ code (and then not compiling)""" +const t8_geometry_c = t8_geometry -# Arguments -* `coords_in`:\\[in\\] The incoming coordinates of the vectors -* `coords_out`:\\[out\\] The computed coordinates of the vectors -* `num_vertices`:\\[in\\] The number of vertices/vectors -* `alpha`:\\[in\\] Scaling factor for the vectors -* `b`:\\[in\\] Translation of the vectors. -### Prototype -```c -void t8_cmesh_coords_axb (const double *coords_in, double *coords_out, int num_vertices, double alpha, const double b[3]); -``` """ -function t8_cmesh_coords_axb(coords_in, coords_out, num_vertices, alpha, b) - @ccall libt8.t8_cmesh_coords_axb(coords_in::Ptr{Cdouble}, coords_out::Ptr{Cdouble}, num_vertices::Cint, alpha::Cdouble, b::Ptr{Cdouble})::Cvoid -end + t8_cmesh_register_geometry(cmesh, geometry) -""" - t8_cmesh_translate_coordinates(coords_in, coords_out, num_vertices, translate) +Register a geometry in the cmesh. The cmesh takes ownership of the geometry. -Compute y = x + translate on an array of doubles, interpreting each 3 as one vector x +If no geometry is registered and cmesh is modified from another cmesh then the other cmesh's geometries are used. + +!!! note + + If you need to use t8_cmesh_bcast, then all geometries must be registered *after* the bcast operation, not before. # Arguments -* `coords_in`:\\[in\\] The incoming coordinates of the vectors -* `coords_out`:\\[out\\] The computed coordinates of the vectors -* `num_vertices`:\\[in\\] The number of vertices/vectors -* `translate`:\\[in\\] Translation of the vectors. +* `cmesh`:\\[in,out\\] The cmesh. +* `geometry`:\\[in\\] The geometry to register. ### Prototype ```c -void t8_cmesh_translate_coordinates (const double *coords_in, double *coords_out, const int num_vertices, const double translate[3]); +void t8_cmesh_register_geometry (t8_cmesh_t cmesh, t8_geometry_c *geometry); ``` """ -function t8_cmesh_translate_coordinates(coords_in, coords_out, num_vertices, translate) - @ccall libt8.t8_cmesh_translate_coordinates(coords_in::Ptr{Cdouble}, coords_out::Ptr{Cdouble}, num_vertices::Cint, translate::Ptr{Cdouble})::Cvoid +function t8_cmesh_register_geometry(cmesh, geometry) + @ccall libt8.t8_cmesh_register_geometry(cmesh::t8_cmesh_t, geometry::Ptr{t8_geometry_c})::Cvoid end """ - t8_cmesh_new_translate_vertices_to_attributes(tvertices, vertices, attr_vertices, num_vertices) + t8_cmesh_set_tree_geometry(cmesh, gtreeid, geom) -TODO: Add proper documentation +Set the geometry for a tree, thus specify which geometry to use for this tree. +# Arguments +* `cmesh`:\\[in\\] A non-committed cmesh. +* `gtreeid`:\\[in\\] A global tree id in *cmesh*. +* `geom`:\\[in\\] The geometry to use for this tree. See also t8_cmesh_get_tree_geometry ### Prototype ```c -void t8_cmesh_new_translate_vertices_to_attributes (const t8_locidx_t *tvertices, const double *vertices, double *attr_vertices, const int num_vertices); +void t8_cmesh_set_tree_geometry (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const t8_geometry_c *geom); ``` """ -function t8_cmesh_new_translate_vertices_to_attributes(tvertices, vertices, attr_vertices, num_vertices) - @ccall libt8.t8_cmesh_new_translate_vertices_to_attributes(tvertices::Ptr{t8_locidx_t}, vertices::Ptr{Cdouble}, attr_vertices::Ptr{Cdouble}, num_vertices::Cint)::Cvoid +function t8_cmesh_set_tree_geometry(cmesh, gtreeid, geom) + @ccall libt8.t8_cmesh_set_tree_geometry(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t, geom::Ptr{t8_geometry_c})::Cvoid end """ - t8_cmesh_debug_print_trees(cmesh, comm) + t8_cmesh_commit(cmesh, comm) ### Prototype ```c -void t8_cmesh_debug_print_trees (const t8_cmesh_t cmesh, sc_MPI_Comm comm); +void t8_cmesh_commit (t8_cmesh_t cmesh, sc_MPI_Comm comm); ``` """ -function t8_cmesh_debug_print_trees(cmesh, comm) - @ccall libt8.t8_cmesh_debug_print_trees(cmesh::t8_cmesh_t, comm::MPI_Comm)::Cvoid +function t8_cmesh_commit(cmesh, comm) + @ccall libt8.t8_cmesh_commit(cmesh::t8_cmesh_t, comm::Cint)::Cvoid end """ - t8_netcdf_variable_type - -This enumeration contains all possible netCDF variable datatypes (int, int64, double). - -| Enumerator | Note | -| :------------------- | :------------------------------------------------------------------- | -| T8\\_NETCDF\\_INT | Symbolizes netCDF variable datatype which holds 32-bit integer data | -| T8\\_NETCDF\\_INT64 | Symbolizes netCDF variable datatype which holds 64-bit integer data | -| T8\\_NETCDF\\_DOUBLE | Symbolizes netCDF variable datatype which holds double data | -""" -@cenum t8_netcdf_variable_type::UInt32 begin - T8_NETCDF_INT = 0 - T8_NETCDF_INT64 = 1 - T8_NETCDF_DOUBLE = 2 -end + t8_cmesh_save(cmesh, fileprefix) -"""This enumeration contains all possible netCDF variable datatypes (int, int64, double).""" -const t8_netcdf_variable_type_t = t8_netcdf_variable_type +Save the cmesh to a file with the given fileprefix. -struct t8_netcdf_variable_t - variable_name::Cstring - variable_long_name::Cstring - variable_units::Cstring - datatype::t8_netcdf_variable_type_t - var_user_dimid::Cint - var_user_data::Ptr{sc_array_t} -end +!!! note -""" - t8_cmesh_write_netcdf(cmesh, file_prefix, file_title, dim, num_extern_netcdf_vars, variables, comm) + Currently, it is only legal to save cmeshes that use the linear geometry. +# Arguments +* `cmesh`:\\[in\\] The cmesh to save. +* `fileprefix`:\\[in\\] The prefix of the file to save the cmesh to. ### Prototype ```c -void t8_cmesh_write_netcdf (t8_cmesh_t cmesh, const char *file_prefix, const char *file_title, int dim, int num_extern_netcdf_vars, t8_netcdf_variable_t *variables[], sc_MPI_Comm comm); +int t8_cmesh_save (t8_cmesh_t cmesh, const char *fileprefix); ``` """ -function t8_cmesh_write_netcdf(cmesh, file_prefix, file_title, dim, num_extern_netcdf_vars, variables, comm) - @ccall libt8.t8_cmesh_write_netcdf(cmesh::t8_cmesh_t, file_prefix::Cstring, file_title::Cstring, dim::Cint, num_extern_netcdf_vars::Cint, variables::Ptr{Ptr{t8_netcdf_variable_t}}, comm::MPI_Comm)::Cvoid -end - -struct t8_msh_file_node_t - index::t8_locidx_t - coordinates::NTuple{3, Cdouble} -end - -struct t8_msh_file_node_parametric_t - index::t8_locidx_t - coordinates::NTuple{3, Cdouble} - parameters::NTuple{2, Cdouble} - parametric::Cint - entity_dim::Cint - entity_tag::t8_locidx_t +function t8_cmesh_save(cmesh, fileprefix) + @ccall libt8.t8_cmesh_save(cmesh::t8_cmesh_t, fileprefix::Cstring)::Cint end """ - t8_cmesh_from_msh_file(fileprefix, partition, comm, dim, master, use_cad_geometry) + t8_cmesh_load(filename, comm) ### Prototype ```c -t8_cmesh_t t8_cmesh_from_msh_file (const char *fileprefix, int partition, sc_MPI_Comm comm, int dim, int master, int use_cad_geometry); +t8_cmesh_t t8_cmesh_load (const char *filename, sc_MPI_Comm comm); ``` """ -function t8_cmesh_from_msh_file(fileprefix, partition, comm, dim, master, use_cad_geometry) - @ccall libt8.t8_cmesh_from_msh_file(fileprefix::Cstring, partition::Cint, comm::MPI_Comm, dim::Cint, master::Cint, use_cad_geometry::Cint)::t8_cmesh_t +function t8_cmesh_load(filename, comm) + @ccall libt8.t8_cmesh_load(filename::Cstring, comm::Cint)::t8_cmesh_t end -struct sc_stats - mpicomm::MPI_Comm - sarray::Ptr{sc_array_t} -end +""" + t8_load_mode -"""The statistics container allows dynamically adding random variables.""" -const sc_statistics_t = sc_stats +This enumeration contains all modes in which we can open a saved cmesh. The cmesh can be loaded with more processes than it was saved and the mode controls, which of the processes open files and distribute the data. +| Enumerator | Note | +| :----------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| T8\\_LOAD\\_SIMPLE | In simple mode, the first n processes load the file | +| T8\\_LOAD\\_BGQ | In BGQ mode, the file is loaded on n nodes and from one process of each node. This needs MPI Version 3.1 or higher. | +| T8\\_LOAD\\_STRIDE | Every n-th process loads a file. Handle with care, we introduce it, since on Juqueen MPI-3 was not available. The parameter n has to be passed as an extra parameter. # See also [`t8_cmesh_load_and_distribute`](@ref) | +| T8\\_LOAD\\_COUNT | | """ - sc_statistics_has(stats, name) +@cenum t8_load_mode::UInt32 begin + T8_LOAD_FIRST = 0 + T8_LOAD_SIMPLE = 0 + T8_LOAD_BGQ = 1 + T8_LOAD_STRIDE = 2 + T8_LOAD_COUNT = 3 +end -Returns true if the stats include a variable with the given name +"""This enumeration contains all modes in which we can open a saved cmesh. The cmesh can be loaded with more processes than it was saved and the mode controls, which of the processes open files and distribute the data.""" +const t8_load_mode_t = t8_load_mode + +""" + t8_cmesh_load_and_distribute(fileprefix, num_files, comm, mode, procs_per_node) ### Prototype ```c -int sc_statistics_has (sc_statistics_t * stats, const char *name); +t8_cmesh_t t8_cmesh_load_and_distribute (const char *fileprefix, int num_files, sc_MPI_Comm comm, t8_load_mode_t mode, int procs_per_node); ``` """ -function sc_statistics_has(stats, name) - @ccall libsc.sc_statistics_has(stats::Ptr{sc_statistics_t}, name::Cstring)::Cint +function t8_cmesh_load_and_distribute(fileprefix, num_files, comm, mode, procs_per_node) + @ccall libt8.t8_cmesh_load_and_distribute(fileprefix::Cstring, num_files::Cint, comm::Cint, mode::t8_load_mode_t, procs_per_node::Cint)::t8_cmesh_t end """ - sc_statistics_add_empty(stats, name) - -Register a statistics variable by name and set its count to 0. This variable must not exist already. + t8_cmesh_comm_is_valid(cmesh, comm) ### Prototype ```c -void sc_statistics_add_empty (sc_statistics_t * stats, const char *name); +int t8_cmesh_comm_is_valid (t8_cmesh_t cmesh, sc_MPI_Comm comm); ``` """ -function sc_statistics_add_empty(stats, name) - @ccall libsc.sc_statistics_add_empty(stats::Ptr{sc_statistics_t}, name::Cstring)::Cvoid -end - -struct sc_flopinfo - seconds::Cdouble - cwtime::Cdouble - crtime::Cfloat - cptime::Cfloat - cflpops::Clonglong - iwtime::Cdouble - irtime::Cfloat - iptime::Cfloat - iflpops::Clonglong - mflops::Cfloat - use_papi::Cint +function t8_cmesh_comm_is_valid(cmesh, comm) + @ccall libt8.t8_cmesh_comm_is_valid(cmesh::t8_cmesh_t, comm::Cint)::Cint end -const sc_flopinfo_t = sc_flopinfo - """ - sc_flops_snap(fi, snapshot) + t8_cmesh_is_partitioned(cmesh) -Call [`sc_flops_count`](@ref) (fi) and copies fi into snapshot. +Query whether a committed cmesh is partitioned or replicated. # Arguments -* `fi`:\\[in,out\\] Members will be updated. -* `snapshot`:\\[out\\] On output is a copy of fi. +* `cmesh`:\\[in\\] A committed cmesh. +# Returns +True if *cmesh* is partitioned. False otherwise. *cmesh* must be committed before calling this function. ### Prototype ```c -void sc_flops_snap (sc_flopinfo_t * fi, sc_flopinfo_t * snapshot); +int t8_cmesh_is_partitioned (t8_cmesh_t cmesh); ``` """ -function sc_flops_snap(fi, snapshot) - @ccall libsc.sc_flops_snap(fi::Ptr{sc_flopinfo_t}, snapshot::Ptr{sc_flopinfo_t})::Cvoid +function t8_cmesh_is_partitioned(cmesh) + @ccall libt8.t8_cmesh_is_partitioned(cmesh::t8_cmesh_t)::Cint end """ - sc_flops_shot(fi, snapshot) + t8_cmesh_get_dimension(cmesh) -Call [`sc_flops_count`](@ref) (fi) and override snapshot interval timings with the differences since the previous call to [`sc_flops_snap`](@ref). The interval mflop rate is computed by iflpops / 1e6 / irtime. The cumulative timings in snapshot are copied form fi. +Get the dimension of a cmesh. # Arguments -* `fi`:\\[in,out\\] Members will be updated. -* `snapshot`:\\[in,out\\] Interval timings measured since [`sc_flops_snap`](@ref). +* `cmesh`:\\[in\\] The cmesh. *cmesh* must be committed before calling this function. ### Prototype ```c -void sc_flops_shot (sc_flopinfo_t * fi, sc_flopinfo_t * snapshot); +int t8_cmesh_get_dimension (const t8_cmesh_t cmesh); ``` """ -function sc_flops_shot(fi, snapshot) - @ccall libsc.sc_flops_shot(fi::Ptr{sc_flopinfo_t}, snapshot::Ptr{sc_flopinfo_t})::Cvoid +function t8_cmesh_get_dimension(cmesh) + @ccall libt8.t8_cmesh_get_dimension(cmesh::t8_cmesh_t)::Cint end """ - sc_statistics_accumulate(stats, name, value) + t8_cmesh_get_num_trees(cmesh) -Add an instance of a statistics variable, see [`sc_stats_accumulate`](@ref) The variable must previously be added with [`sc_statistics_add_empty`](@ref). +Return the global number of trees in a cmesh. +# Arguments +* `cmesh`:\\[in\\] The cmesh to be considered. +# Returns +The number of trees associated to *cmesh*. *cmesh* must be committed before calling this function. ### Prototype ```c -void sc_statistics_accumulate (sc_statistics_t * stats, const char *name, double value); +t8_gloidx_t t8_cmesh_get_num_trees (t8_cmesh_t cmesh); ``` """ -function sc_statistics_accumulate(stats, name, value) - @ccall libsc.sc_statistics_accumulate(stats::Ptr{sc_statistics_t}, name::Cstring, value::Cdouble)::Cvoid +function t8_cmesh_get_num_trees(cmesh) + @ccall libt8.t8_cmesh_get_num_trees(cmesh::t8_cmesh_t)::t8_gloidx_t end """ - sc_flops_papi(rtime, ptime, flpops, mflops) + t8_cmesh_get_num_local_trees(cmesh) -Calls PAPI\\_flops. Aborts on PAPI error. The first call sets up the performance counters. Subsequent calls return cumulative real and process times, cumulative floating point operations and the flop rate since the last call. This is a compatibility wrapper: users should only need to use the [`sc_flopinfo_t`](@ref) interface functions below. +Return the number of local trees of a cmesh. If the cmesh is not partitioned this is equivalent to t8_cmesh_get_num_trees. +# Arguments +* `cmesh`:\\[in\\] The cmesh to be considered. +# Returns +The number of local trees of the cmesh. *cmesh* must be committed before calling this function. ### Prototype ```c -void sc_flops_papi (float *rtime, float *ptime, long long *flpops, float *mflops); +t8_locidx_t t8_cmesh_get_num_local_trees (t8_cmesh_t cmesh); ``` """ -function sc_flops_papi(rtime, ptime, flpops, mflops) - @ccall libsc.sc_flops_papi(rtime::Ptr{Cfloat}, ptime::Ptr{Cfloat}, flpops::Ptr{Clonglong}, mflops::Ptr{Cfloat})::Cvoid +function t8_cmesh_get_num_local_trees(cmesh) + @ccall libt8.t8_cmesh_get_num_local_trees(cmesh::t8_cmesh_t)::t8_locidx_t end """ - sc_flops_start(fi) + t8_cmesh_get_num_ghosts(cmesh) -Prepare [`sc_flopinfo_t`](@ref) structure and start flop counters. Must only be called once during the program run. This function calls [`sc_flops_papi`](@ref). +Return the number of ghost trees of a cmesh. If the cmesh is not partitioned this is equivalent to t8_cmesh_get_num_trees. # Arguments -* `fi`:\\[out\\] Members will be initialized. +* `cmesh`:\\[in\\] The cmesh to be considered. +# Returns +The number of ghost trees of the cmesh. *cmesh* must be committed before calling this function. ### Prototype ```c -void sc_flops_start (sc_flopinfo_t * fi); +t8_locidx_t t8_cmesh_get_num_ghosts (t8_cmesh_t cmesh); ``` """ -function sc_flops_start(fi) - @ccall libsc.sc_flops_start(fi::Ptr{sc_flopinfo_t})::Cvoid +function t8_cmesh_get_num_ghosts(cmesh) + @ccall libt8.t8_cmesh_get_num_ghosts(cmesh::t8_cmesh_t)::t8_locidx_t end """ - sc_flops_start_nopapi(fi) + t8_cmesh_get_first_treeid(cmesh) -Prepare [`sc_flopinfo_t`](@ref) structure and ignore the flop counters. This [`sc_flopinfo_t`](@ref) does not call PAPI\\_flops() in this function or in [`sc_flops_count`](@ref)(). +Return the global index of the first local tree of a cmesh. If the cmesh is not partitioned this is always 0. # Arguments -* `fi`:\\[out\\] Members will be initialized. +* `cmesh`:\\[in\\] The cmesh to be considered. +# Returns +The global id of the first local tree in cmesh. *cmesh* must be committed before calling this function. ### Prototype ```c -void sc_flops_start_nopapi (sc_flopinfo_t * fi); +t8_gloidx_t t8_cmesh_get_first_treeid (t8_cmesh_t cmesh); ``` """ -function sc_flops_start_nopapi(fi) - @ccall libsc.sc_flops_start_nopapi(fi::Ptr{sc_flopinfo_t})::Cvoid +function t8_cmesh_get_first_treeid(cmesh) + @ccall libt8.t8_cmesh_get_first_treeid(cmesh::t8_cmesh_t)::t8_gloidx_t end """ - sc_flops_count(fi) + t8_cmesh_get_tree_geometry(cmesh, gtreeid) -Update [`sc_flopinfo_t`](@ref) structure with current measurement. Must only be called after [`sc_flops_start`](@ref). Can be called any number of times. This function calls [`sc_flops_papi`](@ref). +Get the geometry of a tree. # Arguments -* `fi`:\\[in,out\\] Members will be updated. +* `cmesh`:\\[in\\] The cmesh. +* `gtreeid`:\\[in\\] The global tree id of the tree for which the geometry should be returned. +# Returns +The geometry of the tree. ### Prototype ```c -void sc_flops_count (sc_flopinfo_t * fi); +const t8_geometry_c * t8_cmesh_get_tree_geometry (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); ``` """ -function sc_flops_count(fi) - @ccall libsc.sc_flops_count(fi::Ptr{sc_flopinfo_t})::Cvoid -end - -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function sc_flops_shotv(fi, va_list...) - :(@ccall(libsc.sc_flops_shotv(fi::Ptr{sc_flopinfo_t}; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - -""" - sc_keyvalue_entry_type_t - -The values can have different types. - -| Enumerator | Note | -| :------------------------------ | :------------------------------------------ | -| SC\\_KEYVALUE\\_ENTRY\\_NONE | Designate an invalid situation. | -| SC\\_KEYVALUE\\_ENTRY\\_INT | Used for values of type int. | -| SC\\_KEYVALUE\\_ENTRY\\_DOUBLE | Used for values of type double. | -| SC\\_KEYVALUE\\_ENTRY\\_STRING | Used for values of type const char *. | -| SC\\_KEYVALUE\\_ENTRY\\_POINTER | Used for values of anonymous pointer type. | -""" -@cenum sc_keyvalue_entry_type_t::UInt32 begin - SC_KEYVALUE_ENTRY_NONE = 0 - SC_KEYVALUE_ENTRY_INT = 1 - SC_KEYVALUE_ENTRY_DOUBLE = 2 - SC_KEYVALUE_ENTRY_STRING = 3 - SC_KEYVALUE_ENTRY_POINTER = 4 +function t8_cmesh_get_tree_geometry(cmesh, gtreeid) + @ccall libt8.t8_cmesh_get_tree_geometry(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t)::Ptr{t8_geometry_c} end -mutable struct sc_keyvalue end - -"""The key-value container is an opaque structure.""" - -# no prototype is found for this function at sc_keyvalue.h:54:21, please use with caution """ - sc_keyvalue_new() + t8_cmesh_treeid_is_local_tree(cmesh, ltreeid) -Create a new key-value container. +Query whether a given [`t8_locidx_t`](@ref) belongs to a local tree of a cmesh. +# Arguments +* `cmesh`:\\[in\\] The cmesh to be considered. +* `ltreeid`:\\[in\\] An (possible) tree index. # Returns -The container is ready to use. +True if *ltreeid* matches the range of local trees of *cmesh*. False if not. *cmesh* must be committed before calling this function. ### Prototype ```c +int t8_cmesh_treeid_is_local_tree (const t8_cmesh_t cmesh, const t8_locidx_t ltreeid); ``` """ -function sc_keyvalue_new() +function t8_cmesh_treeid_is_local_tree(cmesh, ltreeid) + @ccall libt8.t8_cmesh_treeid_is_local_tree(cmesh::t8_cmesh_t, ltreeid::t8_locidx_t)::Cint end -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function sc_keyvalue_newf(dummy, va_list...) - end - """ - sc_keyvalue_destroy(kv) + t8_cmesh_treeid_is_ghost(cmesh, ltreeid) -Free a key-value container and all internal memory for key storage. +Query whether a given [`t8_locidx_t`](@ref) belongs to a ghost of a cmesh. # Arguments -* `kv`:\\[in,out\\] The key-value container is invalidated by this call. +* `cmesh`:\\[in\\] The cmesh to be considered. +* `ltreeid`:\\[in\\] An (possible) ghost index. +# Returns +True if *ltreeid* matches the range of ghost trees of *cmesh*. False if not. *cmesh* must be committed before calling this function. ### Prototype ```c +int t8_cmesh_treeid_is_ghost (const t8_cmesh_t cmesh, const t8_locidx_t ltreeid); ``` """ -function sc_keyvalue_destroy(kv) +function t8_cmesh_treeid_is_ghost(cmesh, ltreeid) + @ccall libt8.t8_cmesh_treeid_is_ghost(cmesh::t8_cmesh_t, ltreeid::t8_locidx_t)::Cint end """ - sc_keyvalue_exists(kv, key) + t8_cmesh_ltreeid_to_ghostid(cmesh, ltreeid) -Routine to check existence of an entry. +Given a local tree id that belongs to a ghost, return the index of the ghost. # Arguments -* `kv`:\\[in\\] Valid key-value container. -* `key`:\\[in\\] Lookup key to query. +* `cmesh`:\\[in\\] The cmesh to be considered. +* `ltreeid`:\\[in\\] The local id of a ghost, satisfying t8_cmesh_treeid_is_ghost, thus num\\_trees <= *ltreeid* < num\\_trees + num\\_ghosts # Returns -The entry's type if found and SC\\_KEYVALUE\\_ENTRY\\_NONE otherwise. +The index of the ghost within all ghosts, thus an index 0 <= index < num\\_ghosts *cmesh* must be committed before calling this function. ### Prototype ```c +t8_locidx_t t8_cmesh_ltreeid_to_ghostid (const t8_cmesh_t cmesh, const t8_locidx_t ltreeid); ``` """ -function sc_keyvalue_exists(kv, key) +function t8_cmesh_ltreeid_to_ghostid(cmesh, ltreeid) + @ccall libt8.t8_cmesh_ltreeid_to_ghostid(cmesh::t8_cmesh_t, ltreeid::t8_locidx_t)::t8_locidx_t end """ - sc_keyvalue_unset(kv, key) + t8_cmesh_get_first_tree(cmesh) -Routine to remove an entry. +Return a pointer to the first local tree in a cmesh. # Arguments -* `kv`:\\[in\\] Valid key-value container. -* `key`:\\[in\\] Lookup key to remove if it exists. +* `cmesh`:\\[in\\] The cmesh to be queried. # Returns -The entry's type if found and removed, SC\\_KEYVALUE\\_ENTRY\\_NONE otherwise. +A pointer to the first local tree in *cmesh*. If *cmesh* has no local trees, NULL is returned. *cmesh* must be committed before calling this function. ### Prototype ```c +t8_ctree_t t8_cmesh_get_first_tree (t8_cmesh_t cmesh); ``` """ -function sc_keyvalue_unset(kv, key) +function t8_cmesh_get_first_tree(cmesh) + @ccall libt8.t8_cmesh_get_first_tree(cmesh::t8_cmesh_t)::t8_ctree_t end """ - sc_keyvalue_get_int(kv, key, dvalue) + t8_cmesh_get_next_tree(cmesh, tree) -Routines to retrieve an integer value by its key. This function asserts that the key, if existing, points to the correct type. +Given a local tree in a cmesh return a pointer to the next local tree. # Arguments -* `kv`:\\[in\\] Valid key-value container. -* `key`:\\[in\\] Lookup key, may or may not exist. -* `dvalue`:\\[in\\] Default value returned if key is not found. +* `cmesh`:\\[in\\] The cmesh to be queried. +* `tree`:\\[in\\] A local tree in *cmesh*. # Returns -If key is not present then **dvalue** is returned, otherwise the value stored under **key**. +A pointer to the next local tree in *cmesh* after *tree*. If no such tree exists, NULL is returned. * *cmesh* must be committed before calling this function. TODO: If we run over tree numbers only, don't use ctree\\_t in API if possible. ### Prototype ```c +t8_ctree_t t8_cmesh_get_next_tree (t8_cmesh_t cmesh, t8_ctree_t tree); ``` """ -function sc_keyvalue_get_int(kv, key, dvalue) +function t8_cmesh_get_next_tree(cmesh, tree) + @ccall libt8.t8_cmesh_get_next_tree(cmesh::t8_cmesh_t, tree::t8_ctree_t)::t8_ctree_t end """ - sc_keyvalue_get_double(kv, key, dvalue) + t8_cmesh_get_tree(cmesh, ltree_id) -Retrieve a double value by its key. This function asserts that the key, if existing, points to the correct type. +Return a pointer to a given local tree. # Arguments -* `kv`:\\[in\\] Valid key-value container. -* `key`:\\[in\\] Lookup key, may or may not exist. -* `dvalue`:\\[in\\] Default value returned if key is not found. +* `cmesh`:\\[in\\] The cmesh to be queried. +* `ltree_id`:\\[in\\] The local id of the tree that is asked for. # Returns -If key is not present then **dvalue** is returned, otherwise the value stored under **key**. +A pointer to tree in *cmesh* with local id *ltree_id*. The cmesh must have at least *ltree_id* + 1 local trees when calling this function. *cmesh* must be committed before calling this function. ### Prototype ```c +t8_ctree_t t8_cmesh_get_tree (t8_cmesh_t cmesh, t8_locidx_t ltree_id); ``` """ -function sc_keyvalue_get_double(kv, key, dvalue) +function t8_cmesh_get_tree(cmesh, ltree_id) + @ccall libt8.t8_cmesh_get_tree(cmesh::t8_cmesh_t, ltree_id::t8_locidx_t)::t8_ctree_t end """ - sc_keyvalue_get_string(kv, key, dvalue) + t8_cmesh_get_tree_class(cmesh, ltree_id) -Retrieve a string value by its key. This function asserts that the key, if existing, points to the correct type. +Return the eclass of a given local tree. TODO: Should we refer to indices or consequently use ctree\\_t? # Arguments -* `kv`:\\[in\\] Valid key-value container. -* `key`:\\[in\\] Lookup key, may or may not exist. -* `dvalue`:\\[in\\] Default value returned if key is not found. +* `cmesh`:\\[in\\] The cmesh to be considered. +* `ltree_id`:\\[in\\] The local id of the tree whose eclass will be returned. # Returns -If key is not present then **dvalue** is returned, otherwise the value stored under **key**. +The eclass of the given tree. TODO: Call tree ids ltree\\_id or gtree\\_id etc. instead of tree\\_id. *cmesh* must be committed before calling this function. ### Prototype ```c +t8_eclass_t t8_cmesh_get_tree_class (t8_cmesh_t cmesh, t8_locidx_t ltree_id); ``` """ -function sc_keyvalue_get_string(kv, key, dvalue) +function t8_cmesh_get_tree_class(cmesh, ltree_id) + @ccall libt8.t8_cmesh_get_tree_class(cmesh::t8_cmesh_t, ltree_id::t8_locidx_t)::t8_eclass_t end """ - sc_keyvalue_get_pointer(kv, key, dvalue) + t8_cmesh_tree_face_is_boundary(cmesh, ltree_id, face) -Retrieve a pointer value by its key. This function asserts that the key, if existing, points to the correct type. +Query whether a face of a local tree or ghost is at the domain boundary. # Arguments -* `kv`:\\[in\\] Valid key-value container. -* `key`:\\[in\\] Lookup key, may or may not exist. -* `dvalue`:\\[in\\] Default value returned if key is not found. +* `cmesh`:\\[in\\] The cmesh to be considered. +* `ltree_id`:\\[in\\] The local id of a tree. +* `face`:\\[in\\] The number of a face of the tree. # Returns -If key is not present then **dvalue** is returned, otherwise the value stored under **key**. +True if the face is at the domain boundary. False otherwise. *cmesh* must be committed before calling this function. ### Prototype ```c +int t8_cmesh_tree_face_is_boundary (t8_cmesh_t cmesh, t8_locidx_t ltree_id, int face); ``` """ -function sc_keyvalue_get_pointer(kv, key, dvalue) +function t8_cmesh_tree_face_is_boundary(cmesh, ltree_id, face) + @ccall libt8.t8_cmesh_tree_face_is_boundary(cmesh::t8_cmesh_t, ltree_id::t8_locidx_t, face::Cint)::Cint end """ - sc_keyvalue_get_int_check(kv, key, status) + t8_cmesh_get_ghost_class(cmesh, lghost_id) -Query an integer key with error checking. We check whether the key is not found or it is of the wrong type. A default value to be returned on error can be passed in as *status. If status is NULL, then the result on error is undefined. +Return the eclass of a given local ghost. TODO: Should we refer to indices or consequently use cghost\\_t? # Arguments -* `kv`:\\[in\\] Valid key-value table. -* `key`:\\[in\\] Non-NULL key string. -* `status`:\\[in,out\\] If not NULL, set to 0 if there is no error, 1 if the key is not found, 2 if a value is found but its type is not integer, and return the input value *status on error. +* `cmesh`:\\[in\\] The cmesh to be considered. +* `lghost_id`:\\[in\\] The local id of the ghost whose eclass will be returned. 0 <= *tree_id* < cmesh.num\\_ghosts. # Returns -On error we return *status if status is not NULL, and else an undefined value backed by an assertion. Without error, return the result of the lookup. +The eclass of the given ghost. *cmesh* must be committed before calling this function. ### Prototype ```c +t8_eclass_t t8_cmesh_get_ghost_class (t8_cmesh_t cmesh, t8_locidx_t lghost_id); ``` """ -function sc_keyvalue_get_int_check(kv, key, status) +function t8_cmesh_get_ghost_class(cmesh, lghost_id) + @ccall libt8.t8_cmesh_get_ghost_class(cmesh::t8_cmesh_t, lghost_id::t8_locidx_t)::t8_eclass_t end """ - sc_keyvalue_set_int(kv, key, newvalue) + t8_cmesh_get_global_id(cmesh, local_id) -Routine to set an integer value for a given key. +Return the global id of a given local tree or ghost. # Arguments -* `kv`:\\[in\\] Valid key-value table. -* `key`:\\[in\\] Non-NULL key to insert or replace. If it already exists, it must be of type integer. -* `newvalue`:\\[in\\] New value will be stored under key. +* `cmesh`:\\[in\\] The cmesh to be considered. +* `local_id`:\\[in\\] The local id of a tree or a ghost. If *local_id* < cmesh.num\\_local\\_trees then it is a tree, otherwise a ghost. +# Returns +The global id of the tree/ghost. +# See also +https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. + ### Prototype ```c +t8_gloidx_t t8_cmesh_get_global_id (t8_cmesh_t cmesh, t8_locidx_t local_id); ``` """ -function sc_keyvalue_set_int(kv, key, newvalue) +function t8_cmesh_get_global_id(cmesh, local_id) + @ccall libt8.t8_cmesh_get_global_id(cmesh::t8_cmesh_t, local_id::t8_locidx_t)::t8_gloidx_t end """ - sc_keyvalue_set_double(kv, key, newvalue) + t8_cmesh_get_local_id(cmesh, global_id) -Routine to set a double value for a given key. +Return the local id of a give global tree. # Arguments -* `kv`:\\[in\\] Valid key-value table. -* `key`:\\[in\\] Non-NULL key to insert or replace. If it already exists, it must be of type double. -* `newvalue`:\\[in\\] New value will be stored under key. +* `cmesh`:\\[in\\] The cmesh. +* `global_id`:\\[in\\] A global tree id. +# Returns +Either a value l 0 <= *l* < num\\_local\\_trees if *global_id* corresponds to a local tree, or num\\_local\\_trees <= *l* < num\\_local\\_trees + num\\_ghosts if *global_id* corresponds to a ghost trees, or negative if *global_id* neither matches a local nor a ghost tree. +# See also +https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. + ### Prototype ```c +t8_locidx_t t8_cmesh_get_local_id (t8_cmesh_t cmesh, t8_gloidx_t global_id); ``` """ -function sc_keyvalue_set_double(kv, key, newvalue) +function t8_cmesh_get_local_id(cmesh, global_id) + @ccall libt8.t8_cmesh_get_local_id(cmesh::t8_cmesh_t, global_id::t8_gloidx_t)::t8_locidx_t end """ - sc_keyvalue_set_string(kv, key, newvalue) + t8_cmesh_get_face_neighbor(cmesh, ltreeid, face, dual_face, orientation) -Routine to set a string value for a given key. +Given a local tree id and a face number, get information about the face neighbor tree. + +!!! note + + If *ltreeid* is a ghost and it has a neighbor which is neither a local tree or ghost, then the return value will be negative. Thus, a negative return value does not necessarily mean that this is a domain boundary. To find out whether a tree is a domain boundary or not # Arguments -* `kv`:\\[in\\] Valid key-value table. -* `key`:\\[in\\] Non-NULL key to insert or replace. If it already exists, it must be of type string. -* `newvalue`:\\[in\\] New value will be stored under key. +* `cmesh`:\\[in\\] The cmesh to be considered. +* `ltreeid`:\\[in\\] The local id of a tree or a ghost. +* `face`:\\[in\\] A face number of the tree/ghost. +* `dual_face`:\\[out\\] If not NULL, the face number of the neighbor tree at this connection. +* `orientation`:\\[out\\] If not NULL, the face orientation of the connection. +# Returns +If non-negative: The local id of the neighbor tree or ghost. If negative: There is no neighbor across this face. *dual_face* and *orientation* remain unchanged. +# See also +[`t8_cmesh_tree_face_is_boundary`](@ref). + ### Prototype ```c +t8_locidx_t t8_cmesh_get_face_neighbor (const t8_cmesh_t cmesh, const t8_locidx_t ltreeid, const int face, int *dual_face, int *orientation); ``` """ -function sc_keyvalue_set_string(kv, key, newvalue) +function t8_cmesh_get_face_neighbor(cmesh, ltreeid, face, dual_face, orientation) + @ccall libt8.t8_cmesh_get_face_neighbor(cmesh::t8_cmesh_t, ltreeid::t8_locidx_t, face::Cint, dual_face::Ptr{Cint}, orientation::Ptr{Cint})::t8_locidx_t end """ - sc_keyvalue_set_pointer(kv, key, newvalue) + t8_cmesh_get_tree_face_neighbor_eclass(cmesh, ltreeid, face) -Routine to set a pointer value for a given key. +Given a local tree id (of a local tree or ghost tree) and a face compute the eclass of the tree's face neighbor. # Arguments -* `kv`:\\[in\\] Valid key-value table. -* `key`:\\[in\\] Non-NULL key to insert or replace. If it already exists, it must be of type pointer. -* `newvalue`:\\[in\\] New value will be stored under key. +* `cmesh`:\\[in\\] The cmesh to be considered. +* `ltreeid`:\\[in\\] The local id of a tree or a ghost. +* `face`:\\[in\\] A face number of the tree/ghost. +# Returns +The eclass of a neighbor tree of *ltreeid* across *face*. T8\\_ECLASS\\_INVALID if no neighbor exists. ### Prototype ```c +t8_eclass_t t8_cmesh_get_tree_face_neighbor_eclass (const t8_cmesh_t cmesh, const t8_locidx_t ltreeid, const int face); ``` """ -function sc_keyvalue_set_pointer(kv, key, newvalue) +function t8_cmesh_get_tree_face_neighbor_eclass(cmesh, ltreeid, face) + @ccall libt8.t8_cmesh_get_tree_face_neighbor_eclass(cmesh::t8_cmesh_t, ltreeid::t8_locidx_t, face::Cint)::t8_eclass_t end -# typedef int ( * sc_keyvalue_foreach_t ) ( const char * key , const sc_keyvalue_entry_type_t type , void * entry , const void * u ) -""" -Function to call on every key value pair - -# Arguments -* `key`:\\[in\\] The key for this pair -* `type`:\\[in\\] The type of entry -* `entry`:\\[in\\] Pointer to the entry -* `u`:\\[in\\] Arbitrary user data. -# Returns -Return true if the traversal should continue, false to stop. """ -const sc_keyvalue_foreach_t = Ptr{Cvoid} + t8_cmesh_print_profile(cmesh) -""" - sc_keyvalue_foreach(kv, fn, user_data) +Print the collected statistics from a cmesh profile. -Iterate through all stored key-value pairs. +*cmesh* must be committed before calling this function. # Arguments -* `kv`:\\[in\\] Valid key-value container. -* `fn`:\\[in\\] Function to call on each key-value pair. -* `user_data`:\\[in,out\\] This pointer is passed through to **fn**. +* `cmesh`:\\[in\\] The cmesh. +# See also +[`t8_cmesh_set_profiling`](@ref) + ### Prototype ```c +void t8_cmesh_print_profile (t8_cmesh_t cmesh); ``` """ -function sc_keyvalue_foreach(kv, fn, user_data) +function t8_cmesh_print_profile(cmesh) + @ccall libt8.t8_cmesh_print_profile(cmesh::t8_cmesh_t)::Cvoid end """ - sc_statinfo + t8_cmesh_get_tree_vertices(cmesh, ltreeid) -Store information of one random variable. +Return a pointer to the vertex coordinates of a tree. -| Field | Note | -| :--------------- | :--------------------------------------- | -| dirty | Only update stats if this is true. | -| count | Inout; global count is 52 bit accurate. | -| sum\\_values | Inout; global sum of values. | -| sum\\_squares | Inout; global sum of squares. | -| min | Inout; minimum over values. | -| max | Inout; maximum over values. | -| variable | Name of the variable for output. | -| variable\\_owned | NULL or deep copy of variable. | -| group | Grouping identifier. | -| prio | Priority identifier. | +# Arguments +* `cmesh`:\\[in\\] The cmesh. +* `ltreeid`:\\[in\\] The id of a local tree. +# Returns +If stored, a pointer to the vertex coordinates of *tree*. If no coordinates for this tree are found, NULL. +### Prototype +```c +double * t8_cmesh_get_tree_vertices (t8_cmesh_t cmesh, t8_locidx_t ltreeid); +``` """ -struct sc_statinfo - dirty::Cint - count::Clong - sum_values::Cdouble - sum_squares::Cdouble - min::Cdouble - max::Cdouble - min_at_rank::Cint - max_at_rank::Cint - average::Cdouble - variance::Cdouble - standev::Cdouble - variance_mean::Cdouble - standev_mean::Cdouble - variable::Cstring - variable_owned::Cstring - group::Cint - prio::Cint +function t8_cmesh_get_tree_vertices(cmesh, ltreeid) + @ccall libt8.t8_cmesh_get_tree_vertices(cmesh::t8_cmesh_t, ltreeid::t8_locidx_t)::Ptr{Cdouble} end -"""Store information of one random variable.""" -const sc_statinfo_t = sc_statinfo - """ - sc_stats_set1(stats, value, variable) + t8_cmesh_get_attribute(cmesh, package_id, key, ltree_id) -Populate a [`sc_statinfo_t`](@ref) structure assuming count=1 and mark it dirty. We set sc_stats_group_all and sc_stats_prio_all internally. +Return the attribute pointer of a tree. + +!!! note + + *cmesh* must be committed before calling this function. # Arguments -* `stats`:\\[out\\] Will be filled with count=1 and the value. -* `value`:\\[in\\] Value used to fill statistics information. -* `variable`:\\[in\\] String to be reported by sc_stats_print. This string is assigned by pointer, not copied. Thus, it must stay alive while stats is in use. +* `cmesh`:\\[in\\] The cmesh. +* `package_id`:\\[in\\] The identifier of a valid software package. +* `key`:\\[in\\] A key used to identify the attribute under all attributes of this tree with the same *package_id*. +* `ltree_id`:\\[in\\] The local number of the tree. +# Returns +The attribute pointer of the tree *ltree_id* or NULL if the attribute is not found. +# See also +[`sc_package_register`](@ref), [`t8_cmesh_set_attribute`](@ref) + ### Prototype ```c -void sc_stats_set1 (sc_statinfo_t * stats, double value, const char *variable); +void * t8_cmesh_get_attribute (const t8_cmesh_t cmesh, const int package_id, const int key, const t8_locidx_t ltree_id); ``` """ -function sc_stats_set1(stats, value, variable) - @ccall libsc.sc_stats_set1(stats::Ptr{sc_statinfo_t}, value::Cdouble, variable::Cstring)::Cvoid +function t8_cmesh_get_attribute(cmesh, package_id, key, ltree_id) + @ccall libt8.t8_cmesh_get_attribute(cmesh::t8_cmesh_t, package_id::Cint, key::Cint, ltree_id::t8_locidx_t)::Ptr{Cvoid} end """ - sc_stats_set1_ext(stats, value, variable, copy_variable, stats_group, stats_prio) + t8_cmesh_get_attribute_gloidx_array(cmesh, package_id, key, ltree_id, data_count) -Populate a [`sc_statinfo_t`](@ref) structure assuming count=1 and mark it dirty. +Return the attribute pointer of a tree for a gloidx\\_t array. + +!!! note + + *cmesh* must be committed before calling this function. + +!!! note + + No check is performed whether the attribute actually stored *data_count* many entries since we do not store the number of data entries of the attribute array. You can keep track of the data count yourself by using another attribute. # Arguments -* `stats`:\\[out\\] Will be filled with count=1 and the value. -* `value`:\\[in\\] Value used to fill statistics information. -* `variable`:\\[in\\] String to be reported by sc_stats_print. -* `copy_variable`:\\[in\\] If true, make internal copy of variable. Otherwise just assign the pointer. -* `stats_group`:\\[in\\] Non-negative number or sc_stats_group_all. -* `stats_prio`:\\[in\\] Non-negative number or sc_stats_prio_all. +* `cmesh`:\\[in\\] The cmesh. +* `package_id`:\\[in\\] The identifier of a valid software package. +* `key`:\\[in\\] A key used to identify the attribute under all attributes of this tree with the same *package_id*. +* `ltree_id`:\\[in\\] The local number of the tree. +* `data_count`:\\[in\\] The number of entries in the array that are requested. This must be smaller or equal to the *data_count* parameter of the corresponding call to t8_cmesh_set_attribute_gloidx_array +# Returns +The attribute pointer of the tree *ltree_id* or NULL if the attribute is not found. +# See also +[`sc_package_register`](@ref), [`t8_cmesh_set_attribute_gloidx_array`](@ref) + ### Prototype ```c -void sc_stats_set1_ext (sc_statinfo_t * stats, double value, const char *variable, int copy_variable, int stats_group, int stats_prio); +t8_gloidx_t * t8_cmesh_get_attribute_gloidx_array (const t8_cmesh_t cmesh, const int package_id, const int key, const t8_locidx_t ltree_id, const size_t data_count); ``` """ -function sc_stats_set1_ext(stats, value, variable, copy_variable, stats_group, stats_prio) - @ccall libsc.sc_stats_set1_ext(stats::Ptr{sc_statinfo_t}, value::Cdouble, variable::Cstring, copy_variable::Cint, stats_group::Cint, stats_prio::Cint)::Cvoid +function t8_cmesh_get_attribute_gloidx_array(cmesh, package_id, key, ltree_id, data_count) + @ccall libt8.t8_cmesh_get_attribute_gloidx_array(cmesh::t8_cmesh_t, package_id::Cint, key::Cint, ltree_id::t8_locidx_t, data_count::Csize_t)::Ptr{t8_gloidx_t} end """ - sc_stats_init(stats, variable) + t8_cmesh_get_partition_table(cmesh) -Initialize a [`sc_statinfo_t`](@ref) structure assuming count=0 and mark it dirty. This is useful if *stats* will be used to sc_stats_accumulate instances locally before global statistics are computed. We set sc_stats_group_all and sc_stats_prio_all internally. +Return the shared memory array storing the partition table of a partitioned cmesh. # Arguments -* `stats`:\\[out\\] Will be filled with count 0 and values of 0. -* `variable`:\\[in\\] String to be reported by sc_stats_print. This string is assigned by pointer, not copied. Thus, it must stay alive while stats is in use. +* `cmesh`:\\[in\\] The cmesh. +# Returns +The partition array. NULL if the cmesh is not partitioned or the partition array is not stored in *cmesh*. *cmesh* must be committed before calling this function. ### Prototype ```c -void sc_stats_init (sc_statinfo_t * stats, const char *variable); +t8_shmem_array_t t8_cmesh_get_partition_table (t8_cmesh_t cmesh); ``` """ -function sc_stats_init(stats, variable) - @ccall libsc.sc_stats_init(stats::Ptr{sc_statinfo_t}, variable::Cstring)::Cvoid +function t8_cmesh_get_partition_table(cmesh) + @ccall libt8.t8_cmesh_get_partition_table(cmesh::t8_cmesh_t)::t8_shmem_array_t end """ - sc_stats_init_ext(stats, variable, copy_variable, stats_group, stats_prio) + t8_cmesh_uniform_bounds_equal_element_count(cmesh, level, tree_scheme, first_local_tree, child_in_tree_begin, last_local_tree, child_in_tree_end, first_tree_shared) -Initialize a [`sc_statinfo_t`](@ref) structure assuming count=0 and mark it dirty. This is useful if *stats* will be used to sc_stats_accumulate instances locally before global statistics are computed. +Calculate the section of a uniform forest for the current rank. # Arguments -* `stats`:\\[out\\] Will be filled with count 0 and values of 0. -* `variable`:\\[in\\] String to be reported by sc_stats_print. -* `copy_variable`:\\[in\\] If true, make internal copy of variable. Otherwise just assign the pointer. -* `stats_group`:\\[in\\] Non-negative number or sc_stats_group_all. -* `stats_prio`:\\[in\\] Non-negative number or sc_stats_prio_all. Values increase by importance. +* `cmesh`:\\[in\\] The cmesh to be considered. +* `level`:\\[in\\] The uniform refinement level to be created. +* `tree_scheme`:\\[in\\] The element scheme for which to compute the bounds. +* `first_local_tree`:\\[out\\] The first tree that contains elements belonging to the calling processor. +* `child_in_tree_begin`:\\[out\\] The tree-local index of the first element belonging to the calling processor. Not computed if NULL. +* `last_local_tree`:\\[out\\] The last tree that contains elements belonging to the calling processor. +* `child_in_tree_end`:\\[out\\] The tree-local index of the first element that does not belonging to the calling processor anymore. Not computed if NULL. +* `first_tree_shared`:\\[out\\] If not NULL, 1 or 0 is stored here depending on whether *first_local_tree* is the same as *last_local_tree* on the previous process. *cmesh* must be committed before calling this function. ### Prototype ```c -void sc_stats_init_ext (sc_statinfo_t * stats, const char *variable, int copy_variable, int stats_group, int stats_prio); +void t8_cmesh_uniform_bounds_equal_element_count (t8_cmesh_t cmesh, const int level, const t8_scheme_c *tree_scheme, t8_gloidx_t *first_local_tree, t8_gloidx_t *child_in_tree_begin, t8_gloidx_t *last_local_tree, t8_gloidx_t *child_in_tree_end, int8_t *first_tree_shared); ``` """ -function sc_stats_init_ext(stats, variable, copy_variable, stats_group, stats_prio) - @ccall libsc.sc_stats_init_ext(stats::Ptr{sc_statinfo_t}, variable::Cstring, copy_variable::Cint, stats_group::Cint, stats_prio::Cint)::Cvoid +function t8_cmesh_uniform_bounds_equal_element_count(cmesh, level, tree_scheme, first_local_tree, child_in_tree_begin, last_local_tree, child_in_tree_end, first_tree_shared) + @ccall libt8.t8_cmesh_uniform_bounds_equal_element_count(cmesh::t8_cmesh_t, level::Cint, tree_scheme::Ptr{t8_scheme_c}, first_local_tree::Ptr{t8_gloidx_t}, child_in_tree_begin::Ptr{t8_gloidx_t}, last_local_tree::Ptr{t8_gloidx_t}, child_in_tree_end::Ptr{t8_gloidx_t}, first_tree_shared::Ptr{Int8})::Cvoid end """ - sc_stats_reset(stats, reset_vgp) - -Reset all values to zero, optionally unassign name, group, and priority. + t8_cmesh_uniform_bounds_for_irregular_refinement(cmesh, level, scheme, first_local_tree, child_in_tree_begin, last_local_tree, child_in_tree_end, first_tree_shared, comm) -# Arguments -* `stats`:\\[in,out\\] Variables are zeroed. They can be set again by set1 or accumulate. -* `reset_vgp`:\\[in\\] If true, the variable name string is zeroed and if we did a copy, the copy is freed. If true, group and priority are set to all. If false, we don't touch any of the above. ### Prototype ```c -void sc_stats_reset (sc_statinfo_t * stats, int reset_vgp); +void t8_cmesh_uniform_bounds_for_irregular_refinement (const t8_cmesh_t cmesh, const int level, const t8_scheme_c *scheme, t8_gloidx_t *first_local_tree, t8_gloidx_t *child_in_tree_begin, t8_gloidx_t *last_local_tree, t8_gloidx_t *child_in_tree_end, int8_t *first_tree_shared, sc_MPI_Comm comm); ``` """ -function sc_stats_reset(stats, reset_vgp) - @ccall libsc.sc_stats_reset(stats::Ptr{sc_statinfo_t}, reset_vgp::Cint)::Cvoid +function t8_cmesh_uniform_bounds_for_irregular_refinement(cmesh, level, scheme, first_local_tree, child_in_tree_begin, last_local_tree, child_in_tree_end, first_tree_shared, comm) + @ccall libt8.t8_cmesh_uniform_bounds_for_irregular_refinement(cmesh::t8_cmesh_t, level::Cint, scheme::Ptr{t8_scheme_c}, first_local_tree::Ptr{t8_gloidx_t}, child_in_tree_begin::Ptr{t8_gloidx_t}, last_local_tree::Ptr{t8_gloidx_t}, child_in_tree_end::Ptr{t8_gloidx_t}, first_tree_shared::Ptr{Int8}, comm::Cint)::Cvoid end """ - sc_stats_set_group_prio(stats, stats_group, stats_prio) + t8_cmesh_ref(cmesh) -Set/update the group and priority information for a stats item. +Increase the reference counter of a cmesh. # Arguments -* `stats`:\\[out\\] Only group and stats entries are updated. -* `stats_group`:\\[in\\] Non-negative number or sc_stats_group_all. -* `stats_prio`:\\[in\\] Non-negative number or sc_stats_prio_all. Values increase by importance. +* `cmesh`:\\[in,out\\] On input, this cmesh must exist with positive reference count. It may be in any state. ### Prototype ```c -void sc_stats_set_group_prio (sc_statinfo_t * stats, int stats_group, int stats_prio); +void t8_cmesh_ref (t8_cmesh_t cmesh); ``` """ -function sc_stats_set_group_prio(stats, stats_group, stats_prio) - @ccall libsc.sc_stats_set_group_prio(stats::Ptr{sc_statinfo_t}, stats_group::Cint, stats_prio::Cint)::Cvoid +function t8_cmesh_ref(cmesh) + @ccall libt8.t8_cmesh_ref(cmesh::t8_cmesh_t)::Cvoid end """ - sc_stats_accumulate(stats, value) + t8_cmesh_unref(pcmesh) -Add an instance of the random variable. The counter of the variable is increased by one. The value is added into the present values of the variable. +Decrease the reference counter of a cmesh. If the counter reaches zero, this cmesh is destroyed. See also t8_cmesh_destroy, which is to be preferred when it is known that the last reference to a cmesh is deleted. # Arguments -* `stats`:\\[out\\] Must be dirty. We bump count and values. -* `value`:\\[in\\] Value used to update statistics information. +* `pcmesh`:\\[in,out\\] On input, the cmesh pointed to must exist with positive reference count. It may be in any state. If the reference count reaches zero, the cmesh is destroyed and this pointer set to NULL. Otherwise, the pointer is not changed and the cmesh is not modified in other ways. ### Prototype ```c -void sc_stats_accumulate (sc_statinfo_t * stats, double value); +void t8_cmesh_unref (t8_cmesh_t *pcmesh); ``` """ -function sc_stats_accumulate(stats, value) - @ccall libsc.sc_stats_accumulate(stats::Ptr{sc_statinfo_t}, value::Cdouble)::Cvoid +function t8_cmesh_unref(pcmesh) + @ccall libt8.t8_cmesh_unref(pcmesh::Ptr{t8_cmesh_t})::Cvoid end """ - sc_stats_compute(mpicomm, nvars, stats) + t8_cmesh_destroy(pcmesh) +Verify that a coarse mesh has only one reference left and destroy it. This function is preferred over t8_cmesh_unref when it is known that the last reference is to be deleted. + +# Arguments +* `pcmesh`:\\[in,out\\] This cmesh must have a reference count of one. It can be in any state (committed or not). Then it effectively calls t8_cmesh_unref. ### Prototype ```c -void sc_stats_compute (sc_MPI_Comm mpicomm, int nvars, sc_statinfo_t * stats); +void t8_cmesh_destroy (t8_cmesh_t *pcmesh); ``` """ -function sc_stats_compute(mpicomm, nvars, stats) - @ccall libsc.sc_stats_compute(mpicomm::MPI_Comm, nvars::Cint, stats::Ptr{sc_statinfo_t})::Cvoid +function t8_cmesh_destroy(pcmesh) + @ccall libt8.t8_cmesh_destroy(pcmesh::Ptr{t8_cmesh_t})::Cvoid end """ - sc_stats_compute1(mpicomm, nvars, stats) + t8_cmesh_coords_axb(coords_in, coords_out, num_vertices, alpha, b) -### Prototype -```c -void sc_stats_compute1 (sc_MPI_Comm mpicomm, int nvars, sc_statinfo_t * stats); -``` -""" -function sc_stats_compute1(mpicomm, nvars, stats) - @ccall libsc.sc_stats_compute1(mpicomm::MPI_Comm, nvars::Cint, stats::Ptr{sc_statinfo_t})::Cvoid -end - -""" - sc_stats_print(package_id, log_priority, nvars, stats, full, summary) - -Print measured statistics. This function uses the `SC_LC_GLOBAL` log category. That means the default action is to print only on rank 0. Applications can change that by providing a user-defined log handler. All groups and priorities are printed. +Compute y = ax + b on an array of doubles, interpreting each 3 as one vector x # Arguments -* `package_id`:\\[in\\] Registered package id or -1. -* `log_priority`:\\[in\\] Log priority for output according to sc.h. -* `nvars`:\\[in\\] Number of stats items in input array. -* `stats`:\\[in\\] Input array of stats variable items. -* `full`:\\[in\\] Print full information for every variable. -* `summary`:\\[in\\] Print summary information all on 1 line. +* `coords_in`:\\[in\\] The incoming coordinates of the vectors +* `coords_out`:\\[out\\] The computed coordinates of the vectors +* `num_vertices`:\\[in\\] The number of vertices/vectors +* `alpha`:\\[in\\] Scaling factor for the vectors +* `b`:\\[in\\] Translation of the vectors. ### Prototype ```c -void sc_stats_print (int package_id, int log_priority, int nvars, sc_statinfo_t * stats, int full, int summary); +void t8_cmesh_coords_axb (const double *coords_in, double *coords_out, int num_vertices, double alpha, const double b[3]); ``` """ -function sc_stats_print(package_id, log_priority, nvars, stats, full, summary) - @ccall libsc.sc_stats_print(package_id::Cint, log_priority::Cint, nvars::Cint, stats::Ptr{sc_statinfo_t}, full::Cint, summary::Cint)::Cvoid +function t8_cmesh_coords_axb(coords_in, coords_out, num_vertices, alpha, b) + @ccall libt8.t8_cmesh_coords_axb(coords_in::Ptr{Cdouble}, coords_out::Ptr{Cdouble}, num_vertices::Cint, alpha::Cdouble, b::Ptr{Cdouble})::Cvoid end """ - sc_stats_print_ext(package_id, log_priority, nvars, stats, stats_group, stats_prio, full, summary) + t8_cmesh_translate_coordinates(coords_in, coords_out, num_vertices, translate) -Print measured statistics, filter by group and/or priority. This function uses the `SC_LC_GLOBAL` log category. That means the default action is to print only on rank 0. Applications can change that by providing a user-defined log handler. +Compute y = x + translate on an array of doubles, interpreting each 3 as one vector x # Arguments -* `package_id`:\\[in\\] Registered package id or -1. -* `log_priority`:\\[in\\] Log priority for output according to sc.h. -* `nvars`:\\[in\\] Number of stats items in input array. -* `stats`:\\[in\\] Input array of stats variable items. -* `stats_group`:\\[in\\] Print only this group. Non-negative or sc_stats_group_all. We skip printing a variable if neither this parameter nor the item's group is all and if the item's group does not match this. -* `stats_prio`:\\[in\\] Print this and higher priorities. Non-negative or sc_stats_prio_all. We skip printing a variable if neither this parameter nor the item's prio is all and if the item's prio is less than this. -* `full`:\\[in\\] Print full information for every variable. This produces multiple lines including minimum, maximum, and standard deviation. If this is false, print one line per variable. -* `summary`:\\[in\\] Print summary information all on 1 line. This always contains all variables. Not affected by stats\\_group and stats\\_prio. -### Prototype -```c -void sc_stats_print_ext (int package_id, int log_priority, int nvars, sc_statinfo_t * stats, int stats_group, int stats_prio, int full, int summary); -``` -""" -function sc_stats_print_ext(package_id, log_priority, nvars, stats, stats_group, stats_prio, full, summary) - @ccall libsc.sc_stats_print_ext(package_id::Cint, log_priority::Cint, nvars::Cint, stats::Ptr{sc_statinfo_t}, stats_group::Cint, stats_prio::Cint, full::Cint, summary::Cint)::Cvoid -end - -""" - sc_statistics_new(mpicomm) - +* `coords_in`:\\[in\\] The incoming coordinates of the vectors +* `coords_out`:\\[out\\] The computed coordinates of the vectors +* `num_vertices`:\\[in\\] The number of vertices/vectors +* `translate`:\\[in\\] Translation of the vectors. ### Prototype ```c -sc_statistics_t *sc_statistics_new (sc_MPI_Comm mpicomm); +void t8_cmesh_translate_coordinates (const double *coords_in, double *coords_out, const int num_vertices, const double translate[3]); ``` """ -function sc_statistics_new(mpicomm) - @ccall libsc.sc_statistics_new(mpicomm::MPI_Comm)::Ptr{sc_statistics_t} +function t8_cmesh_translate_coordinates(coords_in, coords_out, num_vertices, translate) + @ccall libt8.t8_cmesh_translate_coordinates(coords_in::Ptr{Cdouble}, coords_out::Ptr{Cdouble}, num_vertices::Cint, translate::Ptr{Cdouble})::Cvoid end """ - sc_statistics_destroy(stats) + t8_cmesh_new_translate_vertices_to_attributes(tvertices, vertices, attr_vertices, num_vertices) -Destroy a statistics structure. +TODO: Add proper documentation -# Arguments -* `stats`:\\[in,out\\] Valid object is invalidated. ### Prototype ```c -void sc_statistics_destroy (sc_statistics_t * stats); +void t8_cmesh_new_translate_vertices_to_attributes (const t8_locidx_t *tvertices, const double *vertices, double *attr_vertices, const int num_vertices); ``` """ -function sc_statistics_destroy(stats) - @ccall libsc.sc_statistics_destroy(stats::Ptr{sc_statistics_t})::Cvoid +function t8_cmesh_new_translate_vertices_to_attributes(tvertices, vertices, attr_vertices, num_vertices) + @ccall libt8.t8_cmesh_new_translate_vertices_to_attributes(tvertices::Ptr{t8_locidx_t}, vertices::Ptr{Cdouble}, attr_vertices::Ptr{Cdouble}, num_vertices::Cint)::Cvoid end """ - sc_statistics_add(stats, name) - -Register a statistics variable by name and set its value to 0. This variable must not exist already. + t8_cmesh_debug_print_trees(cmesh, comm) ### Prototype ```c -void sc_statistics_add (sc_statistics_t * stats, const char *name); +void t8_cmesh_debug_print_trees (const t8_cmesh_t cmesh, sc_MPI_Comm comm); ``` """ -function sc_statistics_add(stats, name) - @ccall libsc.sc_statistics_add(stats::Ptr{sc_statistics_t}, name::Cstring)::Cvoid +function t8_cmesh_debug_print_trees(cmesh, comm) + @ccall libt8.t8_cmesh_debug_print_trees(cmesh::t8_cmesh_t, comm::Cint)::Cvoid end """ - sc_statistics_set(stats, name, value) + t8_cmesh_get_local_bounding_box(cmesh, bounds) -Set the value of a statistics variable, see [`sc_stats_set1`](@ref). The variable must previously be added with [`sc_statistics_add`](@ref). This assumes count=1 as in the [`sc_stats_set1`](@ref) function above. +Compute the process local bounding box of the cmesh. The bounding box is stored in the array *bounds* in the following order: bounds[0] = x\\_min bounds[1] = x\\_max bounds[2] = y\\_min bounds[3] = y\\_max bounds[4] = z\\_min bounds[5] = z\\_max +# Arguments +* `cmesh`:\\[in\\] The cmesh to be considered. +* `bounds`:\\[out\\] The bounding box of the cmesh. If the box is flat (for quads for example, z\\_min == z\\_max) +# Returns +True if the computation was successful, false if the cmesh is empty. ### Prototype ```c -void sc_statistics_set (sc_statistics_t * stats, const char *name, double value); +int t8_cmesh_get_local_bounding_box (const t8_cmesh_t cmesh, double bounds[6]); ``` """ -function sc_statistics_set(stats, name, value) - @ccall libsc.sc_statistics_set(stats::Ptr{sc_statistics_t}, name::Cstring, value::Cdouble)::Cvoid +function t8_cmesh_get_local_bounding_box(cmesh, bounds) + @ccall libt8.t8_cmesh_get_local_bounding_box(cmesh::t8_cmesh_t, bounds::Ptr{Cdouble})::Cint end """ - sc_statistics_compute(stats) - -Compute statistics for all variables, see [`sc_stats_compute`](@ref). + sc_io_read(mpifile, ptr, zcount, t, errmsg) ### Prototype ```c -void sc_statistics_compute (sc_statistics_t * stats); +void sc_io_read (sc_MPI_File mpifile, void *ptr, size_t zcount, sc_MPI_Datatype t, const char *errmsg); ``` """ -function sc_statistics_compute(stats) - @ccall libsc.sc_statistics_compute(stats::Ptr{sc_statistics_t})::Cvoid +function sc_io_read(mpifile, ptr, zcount, t, errmsg) + @ccall libt8.sc_io_read(mpifile::Cint, ptr::Ptr{Cvoid}, zcount::Csize_t, t::Cint, errmsg::Cstring)::Cvoid end """ - sc_statistics_print(stats, package_id, log_priority, full, summary) - -Print all statistics variables, see [`sc_stats_print`](@ref). + sc_io_write(mpifile, ptr, zcount, t, errmsg) ### Prototype ```c -void sc_statistics_print (sc_statistics_t * stats, int package_id, int log_priority, int full, int summary); +void sc_io_write (sc_MPI_File mpifile, const void *ptr, size_t zcount, sc_MPI_Datatype t, const char *errmsg); ``` """ -function sc_statistics_print(stats, package_id, log_priority, full, summary) - @ccall libsc.sc_statistics_print(stats::Ptr{sc_statistics_t}, package_id::Cint, log_priority::Cint, full::Cint, summary::Cint)::Cvoid +function sc_io_write(mpifile, ptr, zcount, t, errmsg) + @ccall libt8.sc_io_write(mpifile::Cint, ptr::Ptr{Cvoid}, zcount::Csize_t, t::Cint, errmsg::Cstring)::Cvoid end -mutable struct sc_options end +"""Typedef for quadrant coordinates.""" +const p4est_qcoord_t = Int32 -"""The options data structure is opaque.""" -const sc_options_t = sc_options +"""Typedef for counting topological entities (trees, tree vertices).""" +const p4est_topidx_t = Int32 -# typedef int ( * sc_options_callback_t ) ( sc_options_t * opt , const char * opt_arg , void * data ) -""" -This callback can be invoked with sc_options_parse. +"""Typedef for processor-local indexing of quadrants and nodes.""" +const p4est_locidx_t = Int32 -# Arguments -* `opt`:\\[in\\] Valid options data structure. This is passed as a matter of principle. -* `opt_arg`:\\[in\\] The option argument or NULL if there is none. This variable is internal. Do not store pointer. -* `data`:\\[in\\] User-defined data passed to [`sc_options_add_callback`](@ref). -# Returns -Return 0 if successful, -1 to indicate a parse error. -""" -const sc_options_callback_t = Ptr{Cvoid} +"""Typedef for globally unique indexing of quadrants.""" +const p4est_gloidx_t = Int64 """ - sc_options_new(program_path) + sc_io_error_t -Create an empty options structure. +Error values for io. -# Arguments -* `program_path`:\\[in\\] Name or path name of the program to display. Usually argv[0] is fine. -# Returns -A valid and empty options structure. -### Prototype -```c -sc_options_t *sc_options_new (const char *program_path); -``` +| Enumerator | Note | +| :---------------------- | :--------------------------------------------------------------------------- | +| SC\\_IO\\_ERROR\\_NONE | The value of zero means no error. | +| SC\\_IO\\_ERROR\\_FATAL | The io object is now dysfunctional. | +| SC\\_IO\\_ERROR\\_AGAIN | Another io operation may resolve it. The function just returned was a noop. | """ -function sc_options_new(program_path) - @ccall libsc.sc_options_new(program_path::Cstring)::Ptr{sc_options_t} +@cenum sc_io_error_t::Int32 begin + SC_IO_ERROR_NONE = 0 + SC_IO_ERROR_FATAL = -1 + SC_IO_ERROR_AGAIN = -2 end """ - sc_options_destroy_deep(opt) - -Destroy the options structure and all allocated structures contained. The keyvalue structure passed into sc\\_keyvalue\\_add is destroyed. - -!!! compat "Deprecated" + sc_io_mode_t - This function is kept for backwards compatibility. It is best to destroy any key-value container outside of the lifetime of the options object. +The I/O mode for writing using sc_io_sink. -# Arguments -* `opt`:\\[in,out\\] This options structure is deallocated, including all key-value containers referenced. -### Prototype -```c -void sc_options_destroy_deep (sc_options_t * opt); -``` +| Enumerator | Note | +| :---------------------- | :--------------------------- | +| SC\\_IO\\_MODE\\_WRITE | Semantics as "w" in fopen. | +| SC\\_IO\\_MODE\\_APPEND | Semantics as "a" in fopen. | +| SC\\_IO\\_MODE\\_LAST | Invalid entry to close list | """ -function sc_options_destroy_deep(opt) - @ccall libsc.sc_options_destroy_deep(opt::Ptr{sc_options_t})::Cvoid +@cenum sc_io_mode_t::UInt32 begin + SC_IO_MODE_WRITE = 0 + SC_IO_MODE_APPEND = 1 + SC_IO_MODE_LAST = 2 end """ - sc_options_destroy(opt) + sc_io_encode_t -Destroy the options structure. Whatever has been passed into sc\\_keyvalue\\_add is left alone. +Enum to specify encoding for sc_io_sink and sc_io_source. -# Arguments -* `opt`:\\[in,out\\] This options structure is deallocated. -### Prototype -```c -void sc_options_destroy (sc_options_t * opt); -``` +| Enumerator | Note | +| :---------------------- | :--------------------------- | +| SC\\_IO\\_ENCODE\\_NONE | No encoding | +| SC\\_IO\\_ENCODE\\_LAST | Invalid entry to close list | """ -function sc_options_destroy(opt) - @ccall libsc.sc_options_destroy(opt::Ptr{sc_options_t})::Cvoid +@cenum sc_io_encode_t::UInt32 begin + SC_IO_ENCODE_NONE = 0 + SC_IO_ENCODE_LAST = 1 end """ - sc_options_set_spacing(opt, space_type, space_help) + sc_io_type_t -Set the spacing for sc_options_print_summary. There are two values to be set: the spacing from the beginning of the printed line to the type of the option variable, and from the beginning of the printed line to the help string. +The type of I/O operation sc_io_sink and sc_io_source. -# Arguments -* `opt`:\\[in,out\\] Valid options structure. -* `space_type`:\\[in\\] Number of spaces to the type display, for example , , etc. Setting this negative sets the default 20. -* `space_help`:\\[in\\] Number of space to the help string. Setting this negative sets the default 32. -### Prototype -```c -void sc_options_set_spacing (sc_options_t * opt, int space_type, int space_help); -``` +| Enumerator | Note | +| :------------------------ | :------------------------------- | +| SC\\_IO\\_TYPE\\_BUFFER | Write to a buffer | +| SC\\_IO\\_TYPE\\_FILENAME | Write to a file to be opened | +| SC\\_IO\\_TYPE\\_FILEFILE | Write to an already opened file | +| SC\\_IO\\_TYPE\\_LAST | Invalid entry to close list | """ -function sc_options_set_spacing(opt, space_type, space_help) - @ccall libsc.sc_options_set_spacing(opt::Ptr{sc_options_t}, space_type::Cint, space_help::Cint)::Cvoid +@cenum sc_io_type_t::UInt32 begin + SC_IO_TYPE_BUFFER = 0 + SC_IO_TYPE_FILENAME = 1 + SC_IO_TYPE_FILEFILE = 2 + SC_IO_TYPE_LAST = 3 end """ - sc_options_add_switch(opt, opt_char, opt_name, variable, help_string) + sc_io_sink -Add a switch option. This option is used without option arguments. Every use increments the variable by one. Its initial value is 0. Either opt\\_char or opt\\_name must be valid, that is, not '\\0'/NULL. +A generic data sink. -# Arguments -* `opt`:\\[in,out\\] A valid options structure. -* `opt_char`:\\[in\\] Short option character, may be '\\0'. -* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. -* `variable`:\\[in\\] Address of the variable to store the option value. -* `help_string`:\\[in\\] Help string for usage message, may be NULL. -### Prototype -```c -void sc_options_add_switch (sc_options_t * opt, int opt_char, const char *opt_name, int *variable, const char *help_string); -``` +| Field | Note | +| :------------- | :---------------------------------------------------- | +| iotype | type of the I/O operation | +| mode | write semantics | +| encode | encoding of data | +| buffer | buffer for the iotype SC_IO_TYPE_BUFFER | +| buffer\\_bytes | distinguish from array elements | +| file | file pointer for iotype unequal to SC_IO_TYPE_BUFFER | +| bytes\\_in | input bytes count | +| bytes\\_out | written bytes count | +| is\\_eof | Have we reached the end of file? | """ -function sc_options_add_switch(opt, opt_char, opt_name, variable, help_string) - @ccall libsc.sc_options_add_switch(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Cint}, help_string::Cstring)::Cvoid +struct sc_io_sink + iotype::sc_io_type_t + mode::sc_io_mode_t + encode::sc_io_encode_t + buffer::Ptr{sc_array_t} + buffer_bytes::Csize_t + file::Ptr{Libc.FILE} + bytes_in::Csize_t + bytes_out::Csize_t + is_eof::Cint end +"""A generic data sink.""" +const sc_io_sink_t = sc_io_sink + """ - sc_options_add_bool(opt, opt_char, opt_name, variable, init_value, help_string) + sc_io_source -Add a boolean option. It can be initialized to true or false in the C sense. Specifying it on the command line without argument sets the option to true. The argument 0/f/F/n/N sets it to false (0). The argument 1/t/T/y/Y sets it to true (nonzero). +A generic data source. -# Arguments -* `opt`:\\[in,out\\] A valid options structure. -* `opt_char`:\\[in\\] Short option character, may be '\\0'. -* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. -* `variable`:\\[in\\] Address of the variable to store the option value. -* `init_value`:\\[in\\] Initial value to set the option, read as true or false. -* `help_string`:\\[in\\] Help string for usage message, may be NULL. -### Prototype -```c -void sc_options_add_bool (sc_options_t * opt, int opt_char, const char *opt_name, int *variable, int init_value, const char *help_string); -``` +| Field | Note | +| :-------------- | :---------------------------------------------------- | +| iotype | type of the I/O operation | +| encode | encoding of data | +| buffer | buffer for the iotype SC_IO_TYPE_BUFFER | +| buffer\\_bytes | distinguish from array elements | +| file | file pointer for iotype unequal to SC_IO_TYPE_BUFFER | +| bytes\\_in | input bytes count | +| bytes\\_out | read bytes count | +| is\\_eof | Have we reached the end of file? | +| mirror | if activated, a sink to store the data | +| mirror\\_buffer | if activated, the buffer for the mirror | """ -function sc_options_add_bool(opt, opt_char, opt_name, variable, init_value, help_string) - @ccall libsc.sc_options_add_bool(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Cint}, init_value::Cint, help_string::Cstring)::Cvoid +struct sc_io_source + iotype::sc_io_type_t + encode::sc_io_encode_t + buffer::Ptr{sc_array_t} + buffer_bytes::Csize_t + file::Ptr{Libc.FILE} + bytes_in::Csize_t + bytes_out::Csize_t + is_eof::Cint + mirror::Ptr{sc_io_sink_t} + mirror_buffer::Ptr{sc_array_t} end +"""A generic data source.""" +const sc_io_source_t = sc_io_source + """ - sc_options_add_int(opt, opt_char, opt_name, variable, init_value, help_string) + sc_io_open_mode_t -Add an option that takes an integer argument. +Open modes for sc_io_open -# Arguments -* `opt`:\\[in,out\\] A valid options structure. -* `opt_char`:\\[in\\] Short option character, may be '\\0'. -* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. -* `variable`:\\[in\\] Address of the variable to store the option value. -* `init_value`:\\[in\\] The initial value of the option variable. -* `help_string`:\\[in\\] Help string for usage message, may be NULL. -### Prototype -```c -void sc_options_add_int (sc_options_t * opt, int opt_char, const char *opt_name, int *variable, int init_value, const char *help_string); -``` +| Enumerator | Note | +| :----------------------- | :------------------------------------------------------------------------------------------------------------------ | +| SC\\_IO\\_READ | open a file in read-only mode | +| SC\\_IO\\_WRITE\\_CREATE | open a file in write-only mode; if the file exists, the file will be truncated to length zero and then overwritten | +| SC\\_IO\\_WRITE\\_APPEND | append to an already existing file | """ -function sc_options_add_int(opt, opt_char, opt_name, variable, init_value, help_string) - @ccall libsc.sc_options_add_int(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Cint}, init_value::Cint, help_string::Cstring)::Cvoid +@cenum sc_io_open_mode_t::UInt32 begin + SC_IO_READ = 0 + SC_IO_WRITE_CREATE = 1 + SC_IO_WRITE_APPEND = 2 end +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function sc_io_sink_new(iotype, iomode, ioencode, va_list...) + :(@ccall(libt8.sc_io_sink_new(iotype::Cint, iomode::Cint, ioencode::Cint; $(to_c_type_pairs(va_list)...))::Ptr{sc_io_sink_t})) + end + """ - sc_options_add_size_t(opt, opt_char, opt_name, variable, init_value, help_string) + sc_io_sink_destroy(sink) -Add an option that takes a size\\_t argument. The value of the size\\_t variable must not be greater than LLONG\\_MAX. +Free data sink. Calls [`sc_io_sink_complete`](@ref) and discards the final counts. Errors from complete lead to SC\\_IO\\_ERROR\\_FATAL returned from this function. Call [`sc_io_sink_complete`](@ref) yourself if bytes\\_out is of interest. # Arguments -* `opt`:\\[in,out\\] A valid options structure. -* `opt_char`:\\[in\\] Short option character, may be '\\0'. -* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. -* `variable`:\\[in\\] Address of the variable to store the option value. -* `init_value`:\\[in\\] The initial value of the option variable. -* `help_string`:\\[in\\] Help string for usage message, may be NULL. +* `sink`:\\[in,out\\] The sink object to complete and free. +# Returns +0 on success, nonzero on error. ### Prototype ```c -void sc_options_add_size_t (sc_options_t * opt, int opt_char, const char *opt_name, size_t *variable, size_t init_value, const char *help_string); +int sc_io_sink_destroy (sc_io_sink_t * sink); ``` """ -function sc_options_add_size_t(opt, opt_char, opt_name, variable, init_value, help_string) - @ccall libsc.sc_options_add_size_t(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Csize_t}, init_value::Csize_t, help_string::Cstring)::Cvoid +function sc_io_sink_destroy(sink) + @ccall libt8.sc_io_sink_destroy(sink::Ptr{sc_io_sink_t})::Cint end """ - sc_options_add_double(opt, opt_char, opt_name, variable, init_value, help_string) + sc_io_sink_destroy_null(sink) -Add an option that takes a double argument. The double must be in the legal range. "inf" and "nan" are legal too. +Free data sink and NULL the pointer to it. Except for the handling of the pointer argument, the behavior is the same as for sc_io_sink_destroy. # Arguments -* `opt`:\\[in,out\\] A valid options structure. -* `opt_char`:\\[in\\] Short option character, may be '\\0'. -* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. -* `variable`:\\[in\\] Address of the variable to store the option value. -* `init_value`:\\[in\\] The initial value of the option variable. -* `help_string`:\\[in\\] Help string for usage message, may be NULL. +* `sink`:\\[in,out\\] Non-NULL pointer to sink pointer. The sink pointer may be NULL, in which case this function does nothing successfully, or a valid sc_io_sink, which is passed to sc_io_sink_destroy, and the sink pointer is set to NULL afterwards. +# Returns +0 on success, nonzero on error. ### Prototype ```c -void sc_options_add_double (sc_options_t * opt, int opt_char, const char *opt_name, double *variable, double init_value, const char *help_string); +int sc_io_sink_destroy_null (sc_io_sink_t ** sink); ``` """ -function sc_options_add_double(opt, opt_char, opt_name, variable, init_value, help_string) - @ccall libsc.sc_options_add_double(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Cdouble}, init_value::Cdouble, help_string::Cstring)::Cvoid +function sc_io_sink_destroy_null(sink) + @ccall libt8.sc_io_sink_destroy_null(sink::Ptr{Ptr{sc_io_sink_t}})::Cint end """ - sc_options_add_string(opt, opt_char, opt_name, variable, init_value, help_string) + sc_io_sink_write(sink, data, bytes_avail) -Add a string option. +Write data to a sink. Data may be buffered and sunk in a later call. The internal counters sink->bytes\\_in and sink->bytes\\_out are updated. # Arguments -* `opt`:\\[in,out\\] A valid options structure. -* `opt_char`:\\[in\\] Short option character, may be '\\0'. -* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. -* `variable`:\\[in\\] Address of the variable to store the option value. -* `init_value`:\\[in\\] This default value of the option may be NULL. If not NULL, the value is copied to internal storage. -* `help_string`:\\[in\\] Help string for usage message, may be NULL. +* `sink`:\\[in,out\\] The sink object to write to. +* `data`:\\[in\\] Data passed into sink must be non-NULL. +* `bytes_avail`:\\[in\\] Number of data bytes passed in. +# Returns +0 on success, nonzero on error. ### Prototype ```c -void sc_options_add_string (sc_options_t * opt, int opt_char, const char *opt_name, const char **variable, const char *init_value, const char *help_string); +int sc_io_sink_write (sc_io_sink_t * sink, const void *data, size_t bytes_avail); ``` """ -function sc_options_add_string(opt, opt_char, opt_name, variable, init_value, help_string) - @ccall libsc.sc_options_add_string(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Cstring}, init_value::Cstring, help_string::Cstring)::Cvoid +function sc_io_sink_write(sink, data, bytes_avail) + @ccall libt8.sc_io_sink_write(sink::Ptr{sc_io_sink_t}, data::Ptr{Cvoid}, bytes_avail::Csize_t)::Cint end """ - sc_options_add_inifile(opt, opt_char, opt_name, help_string) + sc_io_sink_complete(sink, bytes_in, bytes_out) -Add an option to read in a file in `.ini` format. The argument to this option must be a filename. On parsing the specified file is read to set known option variables. It does not have an associated option variable itself. +Flush all buffered output data to sink. This function may return SC\\_IO\\_ERROR\\_AGAIN if another write is required. Currently this may happen if BUFFER requires an integer multiple of bytes. If successful, the updated value of bytes read and written is returned in bytes\\_in/out, and the sink status is reset as if the sink had just been created. In particular, the bytes counters are reset to zero. The internal state of the sink is not changed otherwise. It is legal to continue writing to the sink hereafter. The sink actions taken depend on its type. BUFFER, FILEFILE: none. FILENAME: call fclose on sink->file. # Arguments -* `opt`:\\[in,out\\] A valid options structure. -* `opt_char`:\\[in\\] Short option character, may be '\\0'. -* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. -* `help_string`:\\[in\\] Help string for usage message, may be NULL. +* `sink`:\\[in,out\\] The sink object to write to. +* `bytes_in`:\\[in,out\\] Bytes received since the last new or complete call. May be NULL. +* `bytes_out`:\\[in,out\\] Bytes written since the last new or complete call. May be NULL. +# Returns +0 if completed, nonzero on error. ### Prototype ```c -void sc_options_add_inifile (sc_options_t * opt, int opt_char, const char *opt_name, const char *help_string); +int sc_io_sink_complete (sc_io_sink_t * sink, size_t *bytes_in, size_t *bytes_out); ``` """ -function sc_options_add_inifile(opt, opt_char, opt_name, help_string) - @ccall libsc.sc_options_add_inifile(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, help_string::Cstring)::Cvoid +function sc_io_sink_complete(sink, bytes_in, bytes_out) + @ccall libt8.sc_io_sink_complete(sink::Ptr{sc_io_sink_t}, bytes_in::Ptr{Csize_t}, bytes_out::Ptr{Csize_t})::Cint end """ - sc_options_add_jsonfile(opt, opt_char, opt_name, help_string) - -Add an option to read in a file in JSON format. The argument to this option must be a filename. On parsing the specified file is read to set known option variables. It does not have an associated option variable itself. + sc_io_sink_align(sink, bytes_align) -This functionality is only active when sc_have_json returns true, equivalent to the define SC\\_HAVE\\_JSON existing, and ignored otherwise. +Align sink to a byte boundary by writing zeros. # Arguments -* `opt`:\\[in,out\\] A valid options structure. -* `opt_char`:\\[in\\] Short option character, may be '\\0'. -* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. -* `help_string`:\\[in\\] Help string for usage message, may be NULL. +* `sink`:\\[in,out\\] The sink object to align. +* `bytes_align`:\\[in\\] Byte boundary. +# Returns +0 on success, nonzero on error. ### Prototype ```c -void sc_options_add_jsonfile (sc_options_t * opt, int opt_char, const char *opt_name, const char *help_string); +int sc_io_sink_align (sc_io_sink_t * sink, size_t bytes_align); ``` """ -function sc_options_add_jsonfile(opt, opt_char, opt_name, help_string) - @ccall libsc.sc_options_add_jsonfile(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, help_string::Cstring)::Cvoid +function sc_io_sink_align(sink, bytes_align) + @ccall libt8.sc_io_sink_align(sink::Ptr{sc_io_sink_t}, bytes_align::Csize_t)::Cint end +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function sc_io_source_new(iotype, ioencode, va_list...) + :(@ccall(libt8.sc_io_source_new(iotype::Cint, ioencode::Cint; $(to_c_type_pairs(va_list)...))::Ptr{sc_io_source_t})) + end + """ - sc_options_add_callback(opt, opt_char, opt_name, has_arg, fn, data, help_string) + sc_io_source_destroy(source) -Add an option that calls a user-defined function when parsed. The callback function should be implemented to allow multiple calls. The callback may be used to set multiple option variables in bulk that would otherwise require an inconvenient number of individual options. This option is not loaded from or saved to files. +Free data source. Calls [`sc_io_source_complete`](@ref) and requires it to return no error. This is to avoid discarding buffered data that has not been passed to read. # Arguments -* `opt`:\\[in,out\\] A valid options structure. -* `opt_char`:\\[in\\] Short option character, may be '\\0'. -* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. -* `has_arg`:\\[in\\] Specify whether the option needs an option argument. This can be 0 for none, 1 for a required argument, and 2 for an optional argument; see getopt\\_long (3). -* `fn`:\\[in\\] Function to call when this option is encountered. -* `data`:\\[in\\] User-defined data passed to the callback. -* `help_string`:\\[in\\] Help string for usage message, may be NULL. +* `source`:\\[in,out\\] The source object to free. +# Returns +0 on success. Nonzero if an error is encountered or is\\_complete returns one. ### Prototype ```c -void sc_options_add_callback (sc_options_t * opt, int opt_char, const char *opt_name, int has_arg, sc_options_callback_t fn, void *data, const char *help_string); +int sc_io_source_destroy (sc_io_source_t * source); ``` """ -function sc_options_add_callback(opt, opt_char, opt_name, has_arg, fn, data, help_string) - @ccall libsc.sc_options_add_callback(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, has_arg::Cint, fn::sc_options_callback_t, data::Ptr{Cvoid}, help_string::Cstring)::Cvoid +function sc_io_source_destroy(source) + @ccall libt8.sc_io_source_destroy(source::Ptr{sc_io_source_t})::Cint end """ - sc_options_add_keyvalue(opt, opt_char, opt_name, variable, init_value, keyvalue, help_string) + sc_io_source_destroy_null(source) -Add an option that takes string keys into a lookup table of integers. On calling this function, it must be certain that the initial value exists. +Free data source and NULL the pointer to it. Except for the handling of the pointer argument, the behavior is the same as for sc_io_source_destroy. # Arguments -* `opt`:\\[in\\] Initialized options structure. -* `opt_char`:\\[in\\] Option character for command line, or 0. -* `opt_name`:\\[in\\] Name of the long option, or NULL. -* `variable`:\\[in\\] Address of an existing integer that holds the value of this option parameter. -* `init_value`:\\[in\\] The key that is looked up for the initial value. It must be certain that the key exists and its value is of type integer. -* `keyvalue`:\\[in\\] A valid key-value structure where the values must be integers. If a key is asked for that does not exist, we will produce an option error. This structure must stay alive as long as opt. -* `help_string`:\\[in\\] Instructive one-line string to explain the option. +* `source`:\\[in,out\\] Non-NULL pointer to source pointer. The source pointer may be NULL, in which case this function does nothing successfully, or a valid sc_io_source, which is passed to sc_io_source_destroy, and the source pointer is set to NULL afterwards. +# Returns +0 on success, nonzero on error. ### Prototype ```c +int sc_io_source_destroy_null (sc_io_source_t ** source); ``` """ -function sc_options_add_keyvalue(opt, opt_char, opt_name, variable, init_value, keyvalue, help_string) +function sc_io_source_destroy_null(source) + @ccall libt8.sc_io_source_destroy_null(source::Ptr{Ptr{sc_io_source_t}})::Cint end """ - sc_options_add_suboptions(opt, subopt, prefix) + sc_io_source_read(source, data, bytes_avail, bytes_out) -Copy one set of options to another as a subset, with a prefix. The variables referenced by the options and the suboptions are the same. +Read data from a source. The internal counters source->bytes\\_in and source->bytes\\_out are updated. Data is read until the data buffer has not enough room anymore, or source becomes empty. It is possible that data already read internally remains in the source object for the next call. Call [`sc_io_source_complete`](@ref) and check its return value to find out. Returns an error if bytes\\_out is NULL and less than bytes\\_avail are read. # Arguments -* `opt`:\\[in,out\\] A set of options. -* `subopt`:\\[in\\] Another set of options to be copied. -* `prefix`:\\[in\\] The prefix to add to option names as they are copied. If an option has a long name "name" in subopt, its name in opt is "prefix:name"; if an option only has a character 'c' in subopt, its name in opt is "prefix:-c". +* `source`:\\[in,out\\] The source object to read from. +* `data`:\\[in\\] Data buffer for reading from source. If NULL the output data will be ignored and we seek forward in the input. +* `bytes_avail`:\\[in\\] Number of bytes available in data buffer. +* `bytes_out`:\\[in,out\\] If not NULL, byte count read into data buffer. Otherwise, requires to read exactly bytes\\_avail. If this condition is not met, return an error. +# Returns +0 on success, nonzero on error. ### Prototype ```c -void sc_options_add_suboptions (sc_options_t * opt, sc_options_t * subopt, const char *prefix); +int sc_io_source_read (sc_io_source_t * source, void *data, size_t bytes_avail, size_t *bytes_out); ``` """ -function sc_options_add_suboptions(opt, subopt, prefix) - @ccall libsc.sc_options_add_suboptions(opt::Ptr{sc_options_t}, subopt::Ptr{sc_options_t}, prefix::Cstring)::Cvoid +function sc_io_source_read(source, data, bytes_avail, bytes_out) + @ccall libt8.sc_io_source_read(source::Ptr{sc_io_source_t}, data::Ptr{Cvoid}, bytes_avail::Csize_t, bytes_out::Ptr{Csize_t})::Cint end """ - sc_options_print_usage(package_id, log_priority, opt, arg_usage) + sc_io_source_complete(source, bytes_in, bytes_out) -Print a usage message. This function uses the `SC_LC_GLOBAL` log category. That means the default action is to print only on rank 0. Applications can change that by providing a user-defined log handler. +Determine whether all data buffered from source has been returned by read. If it returns SC\\_IO\\_ERROR\\_AGAIN, another [`sc_io_source_read`](@ref) is required. If the call returns no error, the internal counters source->bytes\\_in and source->bytes\\_out are returned to the caller if requested, and reset to 0. The internal state of the source is not changed otherwise. It is legal to continue reading from the source hereafter. # Arguments -* `package_id`:\\[in\\] Registered package id or -1. -* `log_priority`:\\[in\\] Priority for output according to sc_logprios. -* `opt`:\\[in\\] The option structure. -* `arg_usage`:\\[in\\] If not NULL, an string is appended to the usage line. If the string is non-empty, it will be printed after the option summary and an "ARGUMENTS:\\n" title line. Line breaks are identified by strtok(3) and honored. +* `source`:\\[in,out\\] The source object to read from. +* `bytes_in`:\\[in,out\\] If not NULL and true is returned, the total size of the data sourced. +* `bytes_out`:\\[in,out\\] If not NULL and true is returned, total bytes passed out by source\\_read. +# Returns +SC\\_IO\\_ERROR\\_AGAIN if buffered data remaining. Otherwise return ERROR\\_NONE and reset counters. ### Prototype ```c -void sc_options_print_usage (int package_id, int log_priority, sc_options_t * opt, const char *arg_usage); +int sc_io_source_complete (sc_io_source_t * source, size_t *bytes_in, size_t *bytes_out); ``` """ -function sc_options_print_usage(package_id, log_priority, opt, arg_usage) - @ccall libsc.sc_options_print_usage(package_id::Cint, log_priority::Cint, opt::Ptr{sc_options_t}, arg_usage::Cstring)::Cvoid +function sc_io_source_complete(source, bytes_in, bytes_out) + @ccall libt8.sc_io_source_complete(source::Ptr{sc_io_source_t}, bytes_in::Ptr{Csize_t}, bytes_out::Ptr{Csize_t})::Cint end """ - sc_options_print_summary(package_id, log_priority, opt) + sc_io_source_align(source, bytes_align) -Print a summary of all option values. Prints the title "Options:" and a line for every option, then the title "Arguments:" and a line for every argument. This function uses the `SC_LC_GLOBAL` log category. That means the default action is to print only on rank 0. Applications can change that by providing a user-defined log handler. +Align source to a byte boundary by skipping. # Arguments -* `package_id`:\\[in\\] Registered package id or -1. -* `log_priority`:\\[in\\] Priority for output according to sc_logprios. -* `opt`:\\[in\\] The option structure. +* `source`:\\[in,out\\] The source object to align. +* `bytes_align`:\\[in\\] Byte boundary. +# Returns +0 on success, nonzero on error. ### Prototype ```c -void sc_options_print_summary (int package_id, int log_priority, sc_options_t * opt); +int sc_io_source_align (sc_io_source_t * source, size_t bytes_align); ``` """ -function sc_options_print_summary(package_id, log_priority, opt) - @ccall libsc.sc_options_print_summary(package_id::Cint, log_priority::Cint, opt::Ptr{sc_options_t})::Cvoid +function sc_io_source_align(source, bytes_align) + @ccall libt8.sc_io_source_align(source::Ptr{sc_io_source_t}, bytes_align::Csize_t)::Cint end """ - sc_options_load(package_id, err_priority, opt, file) + sc_io_source_activate_mirror(source) -Load a file in the default format and update option values. The default is a file in the `.ini` format; see sc_options_load_ini. +Activate a buffer that mirrors (i.e., stores) the data that was read. # Arguments -* `package_id`:\\[in\\] Registered package id or -1. -* `err_priority`:\\[in\\] Error priority according to sc_logprios. -* `opt`:\\[in\\] The option structure. -* `file`:\\[in\\] Filename of the file to load. +* `source`:\\[in,out\\] The source object to activate mirror in. # Returns -Returns 0 on success, -1 on failure. +0 on success, nonzero on error. ### Prototype ```c -int sc_options_load (int package_id, int err_priority, sc_options_t * opt, const char *file); +int sc_io_source_activate_mirror (sc_io_source_t * source); ``` """ -function sc_options_load(package_id, err_priority, opt, file) - @ccall libsc.sc_options_load(package_id::Cint, err_priority::Cint, opt::Ptr{sc_options_t}, file::Cstring)::Cint +function sc_io_source_activate_mirror(source) + @ccall libt8.sc_io_source_activate_mirror(source::Ptr{sc_io_source_t})::Cint end """ - sc_options_load_ini(package_id, err_priority, opt, inifile, re) + sc_io_source_read_mirror(source, data, bytes_avail, bytes_out) -Load a file in `.ini` format and update entries found under [Options]. An option whose name contains a colon such as "prefix:basename" will be updated by a "basename =" entry in a [prefix] section. +Read data from the source's mirror. Same behaviour as [`sc_io_source_read`](@ref). # Arguments -* `package_id`:\\[in\\] Registered package id or -1. -* `err_priority`:\\[in\\] Error priority according to sc_logprios. -* `opt`:\\[in\\] The option structure. -* `inifile`:\\[in\\] Filename of the ini file to load. -* `re`:\\[in,out\\] Provisioned for runtime error checking implementation; currently must be NULL. +* `source`:\\[in,out\\] The source object to read mirror data from. +* `data`:\\[in\\] Data buffer for reading from source's mirror. If NULL the output data will be thrown away. +* `bytes_avail`:\\[in\\] Number of bytes available in data buffer. +* `bytes_out`:\\[in,out\\] If not NULL, byte count read into data buffer. Otherwise, requires to read exactly bytes\\_avail. # Returns -Returns 0 on success, -1 on failure. +0 on success, nonzero on error. ### Prototype ```c -int sc_options_load_ini (int package_id, int err_priority, sc_options_t * opt, const char *inifile, void *re); +int sc_io_source_read_mirror (sc_io_source_t * source, void *data, size_t bytes_avail, size_t *bytes_out); ``` """ -function sc_options_load_ini(package_id, err_priority, opt, inifile, re) - @ccall libsc.sc_options_load_ini(package_id::Cint, err_priority::Cint, opt::Ptr{sc_options_t}, inifile::Cstring, re::Ptr{Cvoid})::Cint +function sc_io_source_read_mirror(source, data, bytes_avail, bytes_out) + @ccall libt8.sc_io_source_read_mirror(source::Ptr{sc_io_source_t}, data::Ptr{Cvoid}, bytes_avail::Csize_t, bytes_out::Ptr{Csize_t})::Cint end """ - sc_options_load_json(package_id, err_priority, opt, jsonfile, re) + sc_io_file_save(filename, buffer) -Load a file in JSON format and update entries from object "Options". An option whose name contains a colon such as "Prefix:basename" will be updated by a "basename :" entry in a "Prefix" nested object. +Save a buffer to a file in one call. This function performs error checking and always returns cleanly. # Arguments -* `package_id`:\\[in\\] Registered package id or -1. -* `err_priority`:\\[in\\] Error priority according to sc_logprios. -* `opt`:\\[in\\] The option structure. -* `jsonfile`:\\[in\\] Filename of the JSON file to load. -* `re`:\\[in,out\\] Provisioned for runtime error checking implementation; currently must be NULL. +* `filename`:\\[in\\] Name of the file to save. +* `buffer`:\\[in\\] An array of element size 1 and arbitrary contents, which are written to the file. # Returns -Returns 0 on success, -1 on failure. +0 on success, -1 on error. ### Prototype ```c -int sc_options_load_json (int package_id, int err_priority, sc_options_t * opt, const char *jsonfile, void *re); +int sc_io_file_save (const char *filename, sc_array_t * buffer); ``` """ -function sc_options_load_json(package_id, err_priority, opt, jsonfile, re) - @ccall libsc.sc_options_load_json(package_id::Cint, err_priority::Cint, opt::Ptr{sc_options_t}, jsonfile::Cstring, re::Ptr{Cvoid})::Cint +function sc_io_file_save(filename, buffer) + @ccall libt8.sc_io_file_save(filename::Cstring, buffer::Ptr{sc_array_t})::Cint end """ - sc_options_save(package_id, err_priority, opt, inifile) + sc_io_file_load(filename, buffer) -Save all options and arguments to a file in `.ini` format. This function must only be called after successful option parsing. This function should only be called on rank 0. This function will log errors with category `SC_LC_GLOBAL`. An options whose name contains a colon such as "Prefix:basename" will be written in a section titled [Prefix] as "basename =". +Read a file into a buffer in one call. This function performs error checking and always returns cleanly. # Arguments -* `package_id`:\\[in\\] Registered package id or -1. -* `err_priority`:\\[in\\] Error priority according to sc_logprios. -* `opt`:\\[in\\] The option structure. -* `inifile`:\\[in\\] Filename of the ini file to save. +* `filename`:\\[in\\] Name of the file to load. +* `buffer`:\\[in,out\\] On input, an array (not a view) of element size 1 and arbitrary contents. On output and success, the complete file contents. On error, contents are undefined. # Returns -Returns 0 on success, -1 on failure. +0 on success, -1 on error. ### Prototype ```c -int sc_options_save (int package_id, int err_priority, sc_options_t * opt, const char *inifile); +int sc_io_file_load (const char *filename, sc_array_t * buffer); ``` """ -function sc_options_save(package_id, err_priority, opt, inifile) - @ccall libsc.sc_options_save(package_id::Cint, err_priority::Cint, opt::Ptr{sc_options_t}, inifile::Cstring)::Cint +function sc_io_file_load(filename, buffer) + @ccall libt8.sc_io_file_load(filename::Cstring, buffer::Ptr{sc_array_t})::Cint end """ - sc_options_load_args(package_id, err_priority, opt, inifile) + sc_io_encode(data, out) -Load a file in `.ini` format and update entries found under [Arguments]. There needs to be a key Arguments.count specifying the number. Then as many integer keys starting with 0 need to be present. +Encode a block of arbitrary data with the default sc\\_io format. The corresponding decoder function is sc_io_decode. This function cannot crash unless out of memory. + +Currently this function calls sc_io_encode_zlib with compression level Z\\_BEST\\_COMPRESSION (subject to change). Without zlib configured that function works uncompressed. + +The encoding method and input data size can be retrieved, optionally, from the encoded data by sc_io_decode_info. This function decodes the method as a character, which is 'z' for sc_io_encode_zlib. We reserve the characters A-C, d-z indefinitely. # Arguments -* `package_id`:\\[in\\] Registered package id or -1. -* `err_priority`:\\[in\\] Error priority according to sc_logprios. -* `opt`:\\[in\\] The args are stored in this option structure. -* `inifile`:\\[in\\] Filename of the ini file to load. -# Returns -Returns 0 on success, -1 on failure. +* `data`:\\[in,out\\] If *out* is NULL, we work in place. In this case, the array must on input have an element size of 1 byte, which is preserved. After reading all data from this array, it assumes the identity of the *out* argument below. Otherwise, this is a read-only argument that may have arbitrary element size. On input, all data in the array is used. +* `out`:\\[in,out\\] If not NULL, a valid array of element size 1. It must be resizable (not a view). We resize the array to the output data, which always includes a final terminating zero. ### Prototype ```c -int sc_options_load_args (int package_id, int err_priority, sc_options_t * opt, const char *inifile); +void sc_io_encode (sc_array_t *data, sc_array_t *out); ``` """ -function sc_options_load_args(package_id, err_priority, opt, inifile) - @ccall libsc.sc_options_load_args(package_id::Cint, err_priority::Cint, opt::Ptr{sc_options_t}, inifile::Cstring)::Cint +function sc_io_encode(data, out) + @ccall libt8.sc_io_encode(data::Ptr{sc_array_t}, out::Ptr{sc_array_t})::Cvoid end """ - sc_options_parse(package_id, err_priority, opt, argc, argv) + sc_io_encode_zlib(data, out, zlib_compression_level, line_break_character) -Parse command line options. +Encode a block of arbitrary data, compressed, into an ASCII string. This is a two-stage process: zlib compress and then encode to base 64. The output is a NUL-terminated string of printable characters. + +We first compress the data into the zlib deflate format (RFC 1951). The compressor must use no preset dictionary (this is the default). If zlib is detected on configuration, we compress with the given level. If zlib is not detected, we write data equivalent to Z\\_NO\\_COMPRESSION. The status of zlib detection can be queried at compile time using #ifdef [`SC_HAVE_ZLIB`](@ref) or at run time using sc_have_zlib. Both types of result are readable by a standard zlib uncompress call. + +Secondly, we process the input data size as an 8-byte big-endian number, then the letter 'z', and then the zlib compressed data, concatenated, with a base 64 encoder. We break lines after 76 code characters. Each line break consists of two configurable but arbitrary bytes. The line breaks are considered part of the output data specification. The last line is terminated with the same line break and then a NUL. + +This routine can work in place or write to an output array. The corresponding decoder function is sc_io_decode. This function cannot crash unless out of memory. # Arguments -* `package_id`:\\[in\\] Registered package id or -1. -* `err_priority`:\\[in\\] Error priority according to sc_logprios. -* `opt`:\\[in\\] The option structure. -* `argc`:\\[in\\] Length of argument list. -* `argv`:\\[in,out\\] Argument list may be permuted. -# Returns -Returns -1 on an invalid option, otherwise the position of the first non-option argument. +* `data`:\\[in,out\\] If *out* is NULL, we work in place. In this case, the array must on input have an element size of 1 byte, which is preserved. After reading all data from this array, it assumes the identity of the *out* argument below. Otherwise, this is a read-only argument that may have arbitrary element size. On input, all data in the array is used. +* `out`:\\[in,out\\] If not NULL, a valid array of element size 1. It must be resizable (not a view). We resize the array to the output data, which always includes a final terminating zero. +* `zlib_compression_level`:\\[in\\] Compression level between 0 (no compression) and 9 (best compression). The value -1 indicates some default level. +* `line_break_character`:\\[in\\] This character is arbitrary and specifies the first of two line break bytes. The second byte is always ''. ### Prototype ```c -int sc_options_parse (int package_id, int err_priority, sc_options_t * opt, int argc, char **argv); +void sc_io_encode_zlib (sc_array_t *data, sc_array_t *out, int zlib_compression_level, int line_break_character); ``` """ -function sc_options_parse(package_id, err_priority, opt, argc, argv) - @ccall libsc.sc_options_parse(package_id::Cint, err_priority::Cint, opt::Ptr{sc_options_t}, argc::Cint, argv::Ptr{Cstring})::Cint +function sc_io_encode_zlib(data, out, zlib_compression_level, line_break_character) + @ccall libt8.sc_io_encode_zlib(data::Ptr{sc_array_t}, out::Ptr{sc_array_t}, zlib_compression_level::Cint, line_break_character::Cint)::Cvoid end """ - t8_cmesh_from_tetgen_file(fileprefix, partition, comm, do_dup) + sc_io_decode_info(data, original_size, format_char, re) + +Decode length and format of original input from encoded data. We expect at least 12 bytes of the format produced by sc_io_encode. No matter how much data has been encoded by it, this much is available. We decode the original data size and the character indicating the format. +This function does not require zlib. It works with any well-defined data. + +Note that this function is not required before sc_io_decode. Calling this function on any result produced by sc_io_encode will succeed and report a legal format. This function cannot crash. + +# Arguments +* `data`:\\[in\\] This must be an array with element size 1. If it contains less than 12 code bytes we error out. It its first 12 bytes do not base 64 decode to 9 bytes we error out. We generally ignore the remaining data. +* `original_size`:\\[out\\] If not NULL and we do not error out, set to the original size as encoded in the data. +* `format_char`:\\[out\\] If not NULL and we do not error out, the ninth character of decoded data indicating the format. +* `re`:\\[in,out\\] Provided for error reporting, presently must be NULL. +# Returns +0 on success, negative value on error. ### Prototype ```c -t8_cmesh_t t8_cmesh_from_tetgen_file (char *fileprefix, int partition, sc_MPI_Comm comm, int do_dup); +int sc_io_decode_info (sc_array_t *data, size_t *original_size, char *format_char, void *re); ``` """ -function t8_cmesh_from_tetgen_file(fileprefix, partition, comm, do_dup) - @ccall libt8.t8_cmesh_from_tetgen_file(fileprefix::Cstring, partition::Cint, comm::MPI_Comm, do_dup::Cint)::t8_cmesh_t +function sc_io_decode_info(data, original_size, format_char, re) + @ccall libt8.sc_io_decode_info(data::Ptr{sc_array_t}, original_size::Ptr{Csize_t}, format_char::Cstring, re::Ptr{Cvoid})::Cint end """ - t8_cmesh_from_tetgen_file_time(fileprefix, partition, comm, do_dup, fi, snapshot, stats, statentry) + sc_io_decode(data, out, max_original_size, re) + +Decode a block of base 64 encoded compressed data. The base 64 data must contain two arbitrary bytes after every 76 code characters and also at the end of the last line if it is short, and then a final NUL character. This function does not require zlib but benefits for speed. + +This is a two-stage process: we decode the input from base 64 first. Then we extract the 8-byte big-endian original data size, the character 'z', and execute a zlib decompression on the remaining decoded data. This function detects malformed input by erroring out. + +If we should add another format in the future, the format character may be something else than 'z', as permitted by our specification. To this end, we reserve the characters A-C and d-z indefinitely. + +Any error condition is indicated by a negative return value. Possible causes for error are: + +- the input data string is not NUL-terminated - the first 12 characters of input do not decode properly - the input data is corrupt for decoding or decompression - the output data array has non-unit element size and the length of the output data is not divisible by the size - the output data would exceed the specified threshold - the output array is a view of insufficient length + +We also error out if the data requires a compression dictionary, which would be a violation of above encode format specification. + +The corresponding encode function is sc_io_encode. When passing an array as output, we resize it properly. This function cannot crash unless out of memory. +# Arguments +* `data`:\\[in,out\\] If *out* is NULL, we work in place. In that case, output is written into this array after a suitable resize. Either way, we expect a NUL-terminated base 64 encoded string on input that has in turn been obtained by zlib compression. It must be in the exact format produced by sc_io_encode; please see documentation. The element size of the input array must be 1. +* `out`:\\[in,out\\] If not NULL, a valid array (may be a view). If NULL, the input array becomes the output. If the output array is a view and the output data larger than its view size, we error out. We expect commensurable element and data size and resize the output to fit exactly, which restores the original input passed to encoding. An output view array of matching size may be constructed using sc_io_decode_info. +* `max_original_size`:\\[in\\] If nonzero, this is the maximal data size that we will accept after uncompression. If exceeded, return a negative value. +* `re`:\\[in,out\\] Provided for error reporting, presently must be NULL. +# Returns +0 on success, negative on malformed input data or insufficient output space. ### Prototype ```c -t8_cmesh_t t8_cmesh_from_tetgen_file_time (char *fileprefix, int partition, sc_MPI_Comm comm, int do_dup, sc_flopinfo_t *fi, sc_flopinfo_t *snapshot, sc_statinfo_t *stats, int statentry); +int sc_io_decode (sc_array_t *data, sc_array_t *out, size_t max_original_size, void *re); ``` """ -function t8_cmesh_from_tetgen_file_time(fileprefix, partition, comm, do_dup, fi, snapshot, stats, statentry) - @ccall libt8.t8_cmesh_from_tetgen_file_time(fileprefix::Cstring, partition::Cint, comm::MPI_Comm, do_dup::Cint, fi::Ptr{sc_flopinfo_t}, snapshot::Ptr{sc_flopinfo_t}, stats::Ptr{sc_statinfo_t}, statentry::Cint)::t8_cmesh_t +function sc_io_decode(data, out, max_original_size, re) + @ccall libt8.sc_io_decode(data::Ptr{sc_array_t}, out::Ptr{sc_array_t}, max_original_size::Csize_t, re::Ptr{Cvoid})::Cint end """ - t8_cmesh_from_triangle_file(fileprefix, partition, comm, do_dup) + sc_vtk_write_binary(vtkfile, numeric_data, byte_length) +This function writes numeric binary data in VTK base64 encoding. + +# Arguments +* `vtkfile`: Stream opened for writing. +* `numeric_data`: A pointer to a numeric data array. +* `byte_length`: The length of the data array in bytes. +# Returns +Returns 0 on success, -1 on file error. ### Prototype ```c -t8_cmesh_t t8_cmesh_from_triangle_file (char *fileprefix, int partition, sc_MPI_Comm comm, int do_dup); +int sc_vtk_write_binary (FILE * vtkfile, char *numeric_data, size_t byte_length); ``` """ -function t8_cmesh_from_triangle_file(fileprefix, partition, comm, do_dup) - @ccall libt8.t8_cmesh_from_triangle_file(fileprefix::Cstring, partition::Cint, comm::MPI_Comm, do_dup::Cint)::t8_cmesh_t +function sc_vtk_write_binary(vtkfile, numeric_data, byte_length) + @ccall libt8.sc_vtk_write_binary(vtkfile::Ptr{Libc.FILE}, numeric_data::Cstring, byte_length::Csize_t)::Cint end """ - t8_eclass_count_boundary(theclass, min_dim, per_eclass) + sc_vtk_write_compressed(vtkfile, numeric_data, byte_length) -Query the element class and count of boundary points. +This function writes numeric binary data in VTK compressed format. # Arguments -* `theclass`:\\[in\\] We query a point of this element class. -* `min_dim`:\\[in\\] Ignore boundary points of lesser dimension. The ignored points get a count value of 0. -* `per_eclass`:\\[out\\] Array of length T8\\_ECLASS\\_COUNT to be filled with the count of the boundary objects, counted per each of the element classes. +* `vtkfile`: Stream opened for writing. +* `numeric_data`: A pointer to a numeric data array. +* `byte_length`: The length of the data array in bytes. # Returns -The count over all boundary points. +Returns 0 on success, -1 on file error. ### Prototype ```c -int t8_eclass_count_boundary (t8_eclass_t theclass, int min_dim, int *per_eclass); +int sc_vtk_write_compressed (FILE * vtkfile, char *numeric_data, size_t byte_length); ``` """ -function t8_eclass_count_boundary(theclass, min_dim, per_eclass) - @ccall libt8.t8_eclass_count_boundary(theclass::t8_eclass_t, min_dim::Cint, per_eclass::Ptr{Cint})::Cint +function sc_vtk_write_compressed(vtkfile, numeric_data, byte_length) + @ccall libt8.sc_vtk_write_compressed(vtkfile::Ptr{Libc.FILE}, numeric_data::Cstring, byte_length::Csize_t)::Cint end """ - t8_eclass_compare(eclass1, eclass2) + sc_fopen(filename, mode, errmsg) -Compare two eclasses of the same dimension as necessary for face neighbor orientation. The implemented order is Triangle < Square in 2D and Tet < Hex < Prism < Pyramid in 3D. +Wrapper for fopen(3). We provide an additional argument that contains the error message. -# Arguments -* `eclass1`:\\[in\\] The first eclass to compare. -* `eclass2`:\\[in\\] The second eclass to compare. -# Returns -0 if the eclasses are equal, 1 if eclass1 > eclass2 and -1 if eclass1 < eclass2 ### Prototype ```c -int t8_eclass_compare (t8_eclass_t eclass1, t8_eclass_t eclass2); +FILE *sc_fopen (const char *filename, const char *mode, const char *errmsg); ``` """ -function t8_eclass_compare(eclass1, eclass2) - @ccall libt8.t8_eclass_compare(eclass1::t8_eclass_t, eclass2::t8_eclass_t)::Cint +function sc_fopen(filename, mode, errmsg) + @ccall libt8.sc_fopen(filename::Cstring, mode::Cstring, errmsg::Cstring)::Ptr{Libc.FILE} end """ - t8_eclass_is_valid(eclass) + sc_fwrite(ptr, size, nmemb, file, errmsg) -Check whether a class is a valid class. Returns non-zero if it is a valid class, returns zero, if the class is equal to T8\\_ECLASS\\_INVALID. +Write memory content to a file. + +!!! note + + This function aborts on file errors. # Arguments -* `eclass`:\\[in\\] The eclass to check. -# Returns -Non-zero if *eclass* is valid, zero otherwise. +* `ptr`:\\[in\\] Data array to write to disk. +* `size`:\\[in\\] Size of one array member. +* `nmemb`:\\[in\\] Number of array members. +* `file`:\\[in,out\\] File pointer, must be opened for writing. +* `errmsg`:\\[in\\] Error message passed to [`SC_CHECK_ABORT`](@ref). ### Prototype ```c -int t8_eclass_is_valid (t8_eclass_t eclass); +void sc_fwrite (const void *ptr, size_t size, size_t nmemb, FILE * file, const char *errmsg); ``` """ -function t8_eclass_is_valid(eclass) - @ccall libt8.t8_eclass_is_valid(eclass::t8_eclass_t)::Cint +function sc_fwrite(ptr, size, nmemb, file, errmsg) + @ccall libt8.sc_fwrite(ptr::Ptr{Cvoid}, size::Csize_t, nmemb::Csize_t, file::Ptr{Libc.FILE}, errmsg::Cstring)::Cvoid end -mutable struct t8_element end +""" + sc_fread(ptr, size, nmemb, file, errmsg) -"""Opaque structure for a generic element, only used as pointer. Implementations are free to cast it to their internal data structure.""" -const t8_element_t = t8_element +Read file content into memory. -""" - t8_scheme_cxx_ref(scheme) +!!! note -Increase the reference counter of a scheme. + This function aborts on file errors. # Arguments -* `scheme`:\\[in,out\\] On input, this scheme must be alive, that is, exist with positive reference count. +* `ptr`:\\[out\\] Data array to read from disk. +* `size`:\\[in\\] Size of one array member. +* `nmemb`:\\[in\\] Number of array members. +* `file`:\\[in,out\\] File pointer, must be opened for reading. +* `errmsg`:\\[in\\] Error message passed to [`SC_CHECK_ABORT`](@ref). ### Prototype ```c -void t8_scheme_cxx_ref (t8_scheme_cxx_t *scheme); +void sc_fread (void *ptr, size_t size, size_t nmemb, FILE * file, const char *errmsg); ``` """ -function t8_scheme_cxx_ref(scheme) - @ccall libt8.t8_scheme_cxx_ref(scheme::Ptr{t8_scheme_cxx_t})::Cvoid +function sc_fread(ptr, size, nmemb, file, errmsg) + @ccall libt8.sc_fread(ptr::Ptr{Cvoid}, size::Csize_t, nmemb::Csize_t, file::Ptr{Libc.FILE}, errmsg::Cstring)::Cvoid end """ - t8_scheme_cxx_unref(pscheme) + sc_fflush_fsync_fclose(file) -Decrease the reference counter of a scheme. If the counter reaches zero, this scheme is destroyed. +Best effort to flush a file's data to disc and close it. # Arguments -* `pscheme`:\\[in,out\\] On input, the scheme pointed to must exist with positive reference count. If the reference count reaches zero, the scheme is destroyed and this pointer set to NULL. Otherwise, the pointer is not changed and the scheme is not modified in other ways. +* `file`:\\[in,out\\] File open for writing. ### Prototype ```c -void t8_scheme_cxx_unref (t8_scheme_cxx_t **pscheme); +void sc_fflush_fsync_fclose (FILE * file); ``` """ -function t8_scheme_cxx_unref(pscheme) - @ccall libt8.t8_scheme_cxx_unref(pscheme::Ptr{Ptr{t8_scheme_cxx_t}})::Cvoid +function sc_fflush_fsync_fclose(file) + @ccall libt8.sc_fflush_fsync_fclose(file::Ptr{Libc.FILE})::Cvoid end """ - t8_scheme_cxx_destroy(s) + sc_io_open(mpicomm, filename, amode, mpiinfo, mpifile) ### Prototype ```c -extern void t8_scheme_cxx_destroy (t8_scheme_cxx_t *s); +int sc_io_open (sc_MPI_Comm mpicomm, const char *filename, sc_io_open_mode_t amode, sc_MPI_Info mpiinfo, sc_MPI_File * mpifile); ``` """ -function t8_scheme_cxx_destroy(s) - @ccall libt8.t8_scheme_cxx_destroy(s::Ptr{t8_scheme_cxx_t})::Cvoid +function sc_io_open(mpicomm, filename, amode, mpiinfo, mpifile) + @ccall libt8.sc_io_open(mpicomm::Cint, filename::Cstring, amode::sc_io_open_mode_t, mpiinfo::Cint, mpifile::Ptr{Cint})::Cint end """ - t8_element_size(ts) - -Return the size of any element of a given class. + sc_io_read_at(mpifile, offset, ptr, count, t, ocount) -# Returns -The size of an element of class **ts**. We provide a default implementation of this routine that should suffice for most use cases. ### Prototype ```c -size_t t8_element_size (const t8_eclass_scheme_c *ts); +int sc_io_read_at (sc_MPI_File mpifile, sc_MPI_Offset offset, void *ptr, int count, sc_MPI_Datatype t, int *ocount); ``` """ -function t8_element_size(ts) - @ccall libt8.t8_element_size(ts::Ptr{t8_eclass_scheme_c})::Csize_t +function sc_io_read_at(mpifile, offset, ptr, count, t, ocount) + @ccall libt8.sc_io_read_at(mpifile::Cint, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::Cint, ocount::Ptr{Cint})::Cint end """ - t8_element_refines_irregular(ts) - -Returns true, if there is one element in the tree, that does not refine into 2^dim children. Returns false otherwise. + sc_io_read_at_all(mpifile, offset, ptr, count, t, ocount) ### Prototype ```c -int t8_element_refines_irregular (const t8_eclass_scheme_c *ts); +int sc_io_read_at_all (sc_MPI_File mpifile, sc_MPI_Offset offset, void *ptr, int count, sc_MPI_Datatype t, int *ocount); ``` """ -function t8_element_refines_irregular(ts) - @ccall libt8.t8_element_refines_irregular(ts::Ptr{t8_eclass_scheme_c})::Cint +function sc_io_read_at_all(mpifile, offset, ptr, count, t, ocount) + @ccall libt8.sc_io_read_at_all(mpifile::Cint, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::Cint, ocount::Ptr{Cint})::Cint end """ - t8_element_maxlevel(ts) - -Return the maximum allowed level for any element of a given class. + sc_io_write_at(mpifile, offset, ptr, count, t, ocount) -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -# Returns -The maximum allowed level for elements of class **ts**. ### Prototype ```c -int t8_element_maxlevel (const t8_eclass_scheme_c *ts); +int sc_io_write_at (sc_MPI_File mpifile, sc_MPI_Offset offset, const void *ptr, int count, sc_MPI_Datatype t, int *ocount); ``` """ -function t8_element_maxlevel(ts) - @ccall libt8.t8_element_maxlevel(ts::Ptr{t8_eclass_scheme_c})::Cint +function sc_io_write_at(mpifile, offset, ptr, count, t, ocount) + @ccall libt8.sc_io_write_at(mpifile::Cint, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::Cint, ocount::Ptr{Cint})::Cint end """ - t8_element_level(ts, elem) + sc_io_write_at_all(mpifile, offset, ptr, count, t, ocount) ### Prototype ```c -int t8_element_level (const t8_eclass_scheme_c *ts, const t8_element_t *elem); +int sc_io_write_at_all (sc_MPI_File mpifile, sc_MPI_Offset offset, const void *ptr, int count, sc_MPI_Datatype t, int *ocount); ``` """ -function t8_element_level(ts, elem) - @ccall libt8.t8_element_level(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t})::Cint +function sc_io_write_at_all(mpifile, offset, ptr, count, t, ocount) + @ccall libt8.sc_io_write_at_all(mpifile::Cint, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::Cint, ocount::Ptr{Cint})::Cint end """ - t8_element_copy(ts, source, dest) - -Copy all entries of **source** to **dest**. **dest** must be an existing element. No memory is allocated by this function. + sc_io_close(file) -!!! note - - *source* and *dest* may point to the same element. - -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `source`:\\[in\\] The element whose entries will be copied to **dest**. -* `dest`:\\[in,out\\] This element's entries will be overwritten with the entries of **source**. ### Prototype ```c -void t8_element_copy (const t8_eclass_scheme_c *ts, const t8_element_t *source, t8_element_t *dest); +int sc_io_close (sc_MPI_File * file); ``` """ -function t8_element_copy(ts, source, dest) - @ccall libt8.t8_element_copy(ts::Ptr{t8_eclass_scheme_c}, source::Ptr{t8_element_t}, dest::Ptr{t8_element_t})::Cvoid +function sc_io_close(file) + @ccall libt8.sc_io_close(file::Ptr{Cint})::Cint end """ - t8_element_compare(ts, elem1, elem2) - -Compare two elements with respect to the scheme. + p4est_comm_tag -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem1`:\\[in\\] The first element. -* `elem2`:\\[in\\] The second element. -# Returns -negative if elem1 < elem2, zero if elem1 equals elem2 and positive if elem1 > elem2. If elem2 is a copy of elem1 then the elements are equal. -### Prototype -```c -int t8_element_compare (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2); -``` +Tags for MPI messages """ -function t8_element_compare(ts, elem1, elem2) - @ccall libt8.t8_element_compare(ts::Ptr{t8_eclass_scheme_c}, elem1::Ptr{t8_element_t}, elem2::Ptr{t8_element_t})::Cint +@cenum p4est_comm_tag::UInt32 begin + P4EST_COMM_TAG_FIRST = 214 + P4EST_COMM_COUNT_PERTREE = 295 + P4EST_COMM_BALANCE_FIRST_COUNT = 296 + P4EST_COMM_BALANCE_FIRST_LOAD = 297 + P4EST_COMM_BALANCE_SECOND_COUNT = 298 + P4EST_COMM_BALANCE_SECOND_LOAD = 299 + P4EST_COMM_PARTITION_GIVEN = 300 + P4EST_COMM_PARTITION_WEIGHTED_LOW = 301 + P4EST_COMM_PARTITION_WEIGHTED_HIGH = 302 + P4EST_COMM_PARTITION_CORRECTION = 303 + P4EST_COMM_GHOST_COUNT = 304 + P4EST_COMM_GHOST_LOAD = 305 + P4EST_COMM_GHOST_EXCHANGE = 306 + P4EST_COMM_GHOST_EXPAND_COUNT = 307 + P4EST_COMM_GHOST_EXPAND_LOAD = 308 + P4EST_COMM_GHOST_SUPPORT_COUNT = 309 + P4EST_COMM_GHOST_SUPPORT_LOAD = 310 + P4EST_COMM_GHOST_CHECKSUM = 311 + P4EST_COMM_NODES_QUERY = 312 + P4EST_COMM_NODES_REPLY = 313 + P4EST_COMM_SAVE = 314 + P4EST_COMM_LNODES_TEST = 315 + P4EST_COMM_LNODES_PASS = 316 + P4EST_COMM_LNODES_OWNED = 317 + P4EST_COMM_LNODES_ALL = 318 + P4EST_COMM_TAG_LAST = 319 end -""" - t8_element_equal(ts, elem1, elem2) +"""Tags for MPI messages""" +const p4est_comm_tag_t = p4est_comm_tag -Check if two elements are equal. +""" + p4est_log_indent_push() -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem1`:\\[in\\] The first element. -* `elem2`:\\[in\\] The second element. -# Returns -1 if the elements are equal, 0 if they are not equal ### Prototype ```c -int t8_element_equal (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2); +static inline void p4est_log_indent_push (void); ``` """ -function t8_element_equal(ts, elem1, elem2) - @ccall libt8.t8_element_equal(ts::Ptr{t8_eclass_scheme_c}, elem1::Ptr{t8_element_t}, elem2::Ptr{t8_element_t})::Cint +function p4est_log_indent_push() + @ccall libt8.p4est_log_indent_push()::Cvoid end """ - t8_element_parent(ts, elem, parent) - -Compute the parent of a given element **elem** and store it in **parent**. **parent** needs to be an existing element. No memory is allocated by this function. **elem** and **parent** can point to the same element, then the entries of **elem** are overwritten by the ones of its parent. + p4est_log_indent_pop() -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element whose parent will be computed. -* `parent`:\\[in,out\\] This element's entries will be overwritten by those of **elem**'s parent. The storage for this element must exist and match the element class of the parent. ### Prototype ```c -void t8_element_parent (const t8_eclass_scheme_c *ts, const t8_element_t *elem, t8_element_t *parent); +static inline void p4est_log_indent_pop (void); ``` """ -function t8_element_parent(ts, elem, parent) - @ccall libt8.t8_element_parent(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, parent::Ptr{t8_element_t})::Cvoid +function p4est_log_indent_pop() + @ccall libt8.p4est_log_indent_pop()::Cvoid end """ - t8_element_num_siblings(ts, elem) + p4est_init(log_handler, log_threshold) -Compute the number of siblings of an element. That is the number of Children of its parent. +Registers p4est with the SC Library and sets the logging behavior. This function is optional. This function must only be called before additional threads are created. If this function is not called or called with log\\_handler == NULL, the default SC log handler will be used. If this function is not called or called with log\\_threshold == [`SC_LP_DEFAULT`](@ref), the default SC log threshold will be used. The default SC log settings can be changed with [`sc_set_log_defaults`](@ref) (). -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element. -# Returns -The number of siblings of *element*. Note that this number is >= 1, since we count the element itself as a sibling. ### Prototype ```c -int t8_element_num_siblings (const t8_eclass_scheme_c *ts, const t8_element_t *elem); +void p4est_init (sc_log_handler_t log_handler, int log_threshold); ``` """ -function t8_element_num_siblings(ts, elem) - @ccall libt8.t8_element_num_siblings(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t})::Cint +function p4est_init(log_handler, log_threshold) + @ccall libt8.p4est_init(log_handler::sc_log_handler_t, log_threshold::Cint)::Cvoid end """ - t8_element_sibling(ts, elem, sibid, sibling) + p4est_is_initialized() -Compute a specific sibling of a given element **elem** and store it in **sibling**. **sibling** needs to be an existing element. No memory is allocated by this function. **elem** and **sibling** can point to the same element, then the entries of **elem** are overwritten by the ones of its i-th sibling. +Return whether p4est has been initialized or not. Keep in mind that p4est_init is an optional function but it helps with proper parallel logging. -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element whose sibling will be computed. -* `sibid`:\\[in\\] The id of the sibling computed. -* `sibling`:\\[in,out\\] This element's entries will be overwritten by those of **elem**'s sibid-th sibling. The storage for this element must exist and match the element class of the sibling. +Currently there is no inverse to p4est_init, and no way to deinit it. This is ok since initialization generally does no harm. Just do not call libsc's finalize function while p4est is still in use. + +# Returns +True if p4est has been initialized with a call to p4est_init and false otherwise. ### Prototype ```c -void t8_element_sibling (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int sibid, t8_element_t *sibling); +int p4est_is_initialized (void); ``` """ -function t8_element_sibling(ts, elem, sibid, sibling) - @ccall libt8.t8_element_sibling(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, sibid::Cint, sibling::Ptr{t8_element_t})::Cvoid +function p4est_is_initialized() + @ccall libt8.p4est_is_initialized()::Cint end """ - t8_element_num_corners(ts, elem) + p4est_have_zlib() -Compute the number of corners of an element. +Check for a sufficiently recent zlib installation. -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element. # Returns -The number of corners of *element*. +True if zlib is detected in both sc and p4est. ### Prototype ```c -int t8_element_num_corners (const t8_eclass_scheme_c *ts, const t8_element_t *elem); +int p4est_have_zlib (void); ``` """ -function t8_element_num_corners(ts, elem) - @ccall libt8.t8_element_num_corners(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t})::Cint +function p4est_have_zlib() + @ccall libt8.p4est_have_zlib()::Cint end """ - t8_element_num_faces(ts, elem) + p4est_get_package_id() -Compute the number of faces of an element. +Query the package identity as registered in libsc. -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element. # Returns -The number of faces of *element*. +This is -1 before p4est_init has been called and a proper package identifier (>= 0) afterwards. ### Prototype ```c -int t8_element_num_faces (const t8_eclass_scheme_c *ts, const t8_element_t *elem); +int p4est_get_package_id (void); ``` """ -function t8_element_num_faces(ts, elem) - @ccall libt8.t8_element_num_faces(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t})::Cint +function p4est_get_package_id() + @ccall libt8.p4est_get_package_id()::Cint end """ - t8_element_max_num_faces(ts, elem) - -Compute the maximum number of faces of a given element and all of its descendants. + p4est_topidx_hash2(tt) -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element. -# Returns -The number of faces of *element*. ### Prototype ```c -int t8_element_max_num_faces (const t8_eclass_scheme_c *ts, const t8_element_t *elem); +static inline unsigned p4est_topidx_hash2 (const p4est_topidx_t * tt); ``` """ -function t8_element_max_num_faces(ts, elem) - @ccall libt8.t8_element_max_num_faces(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t})::Cint +function p4est_topidx_hash2(tt) + @ccall libt8.p4est_topidx_hash2(tt::Ptr{p4est_topidx_t})::Cuint end """ - t8_element_num_children(ts, elem) - -Compute the number of children of an element when it is refined. + p4est_topidx_hash3(tt) -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element. -# Returns -The number of children of *element*. ### Prototype ```c -int t8_element_num_children (const t8_eclass_scheme_c *ts, const t8_element_t *elem); +static inline unsigned p4est_topidx_hash3 (const p4est_topidx_t * tt); ``` """ -function t8_element_num_children(ts, elem) - @ccall libt8.t8_element_num_children(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t})::Cint +function p4est_topidx_hash3(tt) + @ccall libt8.p4est_topidx_hash3(tt::Ptr{p4est_topidx_t})::Cuint end """ - t8_element_num_face_children(ts, elem, face) - -Compute the number of children of an element's face when the element is refined. + p4est_topidx_hash4(tt) -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element. -* `face`:\\[in\\] A face of *elem*. -# Returns -The number of children of *face* if *elem* is to be refined. ### Prototype ```c -int t8_element_num_face_children (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face); +static inline unsigned p4est_topidx_hash4 (const p4est_topidx_t * tt); ``` """ -function t8_element_num_face_children(ts, elem, face) - @ccall libt8.t8_element_num_face_children(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, face::Cint)::Cint +function p4est_topidx_hash4(tt) + @ccall libt8.p4est_topidx_hash4(tt::Ptr{p4est_topidx_t})::Cuint end """ - t8_element_get_face_corner(ts, elem, face, corner) - -Return the corner number of an element's face corner. Example quad: 2 x --- x 3 | | | | face 1 0 x --- x 1 Thus for face = 1 the output is: corner=0 : 1, corner=1: 3 - -The order in which the corners must be given is determined by the eclass of *element*: LINE/QUAD/TRIANGLE: No specific order. HEX : In Z-order of the face starting with the lowest corner number. TET : Starting with the lowest corner number counterclockwise as seen from 'outside' of the element. + p4est_topidx_is_sorted(t, length) -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `element`:\\[in\\] The element. -* `face`:\\[in\\] A face index for *element*. -* `corner`:\\[in\\] A corner index for the face 0 <= *corner* < num\\_face\\_corners. -# Returns -The corner number of the *corner*-th vertex of *face*. ### Prototype ```c -int t8_element_get_face_corner (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, int corner); +static inline int p4est_topidx_is_sorted (p4est_topidx_t * t, int length); ``` """ -function t8_element_get_face_corner(ts, elem, face, corner) - @ccall libt8.t8_element_get_face_corner(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, face::Cint, corner::Cint)::Cint +function p4est_topidx_is_sorted(t, length) + @ccall libt8.p4est_topidx_is_sorted(t::Ptr{p4est_topidx_t}, length::Cint)::Cint end """ - t8_element_get_corner_face(ts, elem, corner, face) - -Compute the face numbers of the faces sharing an element's corner. Example quad: 2 x --- x 3 | | | | face 1 0 x --- x 1 face 2 Thus for corner = 1 the output is: face=0 : 2, face=1: 1 + p4est_topidx_bsort(t, length) -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `element`:\\[in\\] The element. -* `corner`:\\[in\\] A corner index for the face. -* `face`:\\[in\\] A face index for *corner*. -# Returns -The face number of the *face*-th face at *corner*. ### Prototype ```c -int t8_element_get_corner_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int corner, int face); +static inline void p4est_topidx_bsort (p4est_topidx_t * t, int length); ``` """ -function t8_element_get_corner_face(ts, elem, corner, face) - @ccall libt8.t8_element_get_corner_face(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, corner::Cint, face::Cint)::Cint +function p4est_topidx_bsort(t, length) + @ccall libt8.p4est_topidx_bsort(t::Ptr{p4est_topidx_t}, length::Cint)::Cvoid end """ - t8_element_child(ts, elem, childid, child) - -Construct the child element of a given number. + p4est_partition_cut_uint64(global_num, p, num_procs) -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] This must be a valid element, bigger than maxlevel. -* `childid`:\\[in\\] The number of the child to construct. -* `child`:\\[in,out\\] The storage for this element must exist. On output, a valid element. It is valid to call this function with elem = child. ### Prototype ```c -void t8_element_child (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int childid, t8_element_t *child); +static inline uint64_t p4est_partition_cut_uint64 (uint64_t global_num, int p, int num_procs); ``` """ -function t8_element_child(ts, elem, childid, child) - @ccall libt8.t8_element_child(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, childid::Cint, child::Ptr{t8_element_t})::Cvoid +function p4est_partition_cut_uint64(global_num, p, num_procs) + @ccall libt8.p4est_partition_cut_uint64(global_num::UInt64, p::Cint, num_procs::Cint)::UInt64 end """ - t8_element_children(ts, elem, length, c) - -Construct all children of a given element. - -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] This must be a valid element, bigger than maxlevel. -* `length`:\\[in\\] The length of the output array *c* must match the number of children. -* `c`:\\[in,out\\] The storage for these *length* elements must exist and match the element class in the children's ordering. On output, all children are valid. It is valid to call this function with elem = c[0]. -# See also -[`t8_element_num_children`](@ref) + p4est_partition_cut_gloidx(global_num, p, num_procs) ### Prototype ```c -void t8_element_children (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int length, t8_element_t *c[]); +static inline p4est_gloidx_t p4est_partition_cut_gloidx (p4est_gloidx_t global_num, int p, int num_procs); ``` """ -function t8_element_children(ts, elem, length, c) - @ccall libt8.t8_element_children(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, length::Cint, c::Ptr{Ptr{t8_element_t}})::Cvoid +function p4est_partition_cut_gloidx(global_num, p, num_procs) + @ccall libt8.p4est_partition_cut_gloidx(global_num::p4est_gloidx_t, p::Cint, num_procs::Cint)::p4est_gloidx_t end """ - t8_element_child_id(ts, elem) + p4est_version() -Compute the child id of an element. +Return the full version of p4est. -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] This must be a valid element. # Returns -The child id of elem. +Return the version of p4est using the format `VERSION\\_MAJOR.VERSION\\_MINOR.VERSION\\_POINT`, where `VERSION_POINT` can contain dots and characters, e.g. to indicate the additional number of commits and a git commit hash. ### Prototype ```c -int t8_element_child_id (const t8_eclass_scheme_c *ts, const t8_element_t *elem); +const char *p4est_version (void); ``` """ -function t8_element_child_id(ts, elem) - @ccall libt8.t8_element_child_id(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t})::Cint +function p4est_version() + @ccall libt8.p4est_version()::Cstring end """ - t8_element_ancestor_id(ts, elem, level) + p4est_version_major() -Compute the ancestor id of an element, that is the child id at a given level. +Return the major version of p4est. -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] This must be a valid element. -* `level`:\\[in\\] A refinement level. Must satisfy *level* < elem.level # Returns -The child\\_id of *elem* in regard to its *level* ancestor. +Return the major version of p4est. ### Prototype ```c -int t8_element_ancestor_id (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int level); +int p4est_version_major (void); ``` """ -function t8_element_ancestor_id(ts, elem, level) - @ccall libt8.t8_element_ancestor_id(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, level::Cint)::Cint +function p4est_version_major() + @ccall libt8.p4est_version_major()::Cint end """ - t8_element_is_family(ts, fam) + p4est_version_minor() -Query whether a given set of elements is a family or not. +Return the minor version of p4est. -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `fam`:\\[in\\] An array of as many elements as an element of class **ts** has children. # Returns -Zero if **fam** is not a family, nonzero if it is. +Return the minor version of p4est. ### Prototype ```c -int t8_element_is_family (const t8_eclass_scheme_c *ts, t8_element_t *const *fam); +int p4est_version_minor (void); ``` """ -function t8_element_is_family(ts, fam) - @ccall libt8.t8_element_is_family(ts::Ptr{t8_eclass_scheme_c}, fam::Ptr{Ptr{t8_element_t}})::Cint +function p4est_version_minor() + @ccall libt8.p4est_version_minor()::Cint end """ - t8_element_nca(ts, elem1, elem2, nca) + p4est_connect_type_t -Compute the nearest common ancestor of two elements. That is, the element with highest level that still has both given elements as descendants. +Characterize a type of adjacency. -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem1`:\\[in\\] The first of the two input elements. -* `elem2`:\\[in\\] The second of the two input elements. -* `nca`:\\[in,out\\] The storage for this element must exist and match the element class of the child. On output the unique nearest common ancestor of **elem1** and **elem2**. -### Prototype -```c -void t8_element_nca (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, const t8_element_t *elem2, t8_element_t *nca); -``` +Several functions involve relationships between neighboring trees and/or quadrants, and their behavior depends on how one defines adjacency: 1) entities are adjacent if they share a face, or 2) entities are adjacent if they share a face or corner. [`p4est_connect_type_t`](@ref) is used to choose the desired behavior. This enum must fit into an int8\\_t. + +| Enumerator | Note | +| :----------------------- | :--------------------------------- | +| P4EST\\_CONNECT\\_SELF | No balance whatsoever. | +| P4EST\\_CONNECT\\_FACE | Balance across faces only. | +| P4EST\\_CONNECT\\_ALMOST | = CORNER - 1. | +| P4EST\\_CONNECT\\_CORNER | Balance across faces and corners. | +| P4EST\\_CONNECT\\_FULL | = CORNER. | """ -function t8_element_nca(ts, elem1, elem2, nca) - @ccall libt8.t8_element_nca(ts::Ptr{t8_eclass_scheme_c}, elem1::Ptr{t8_element_t}, elem2::Ptr{t8_element_t}, nca::Ptr{t8_element_t})::Cvoid +@cenum p4est_connect_type_t::UInt32 begin + P4EST_CONNECT_SELF = 20 + P4EST_CONNECT_FACE = 21 + P4EST_CONNECT_ALMOST = 21 + P4EST_CONNECT_CORNER = 22 + P4EST_CONNECT_FULL = 22 end -"""Type definition for the geometric shape of an element. Currently the possible shapes are the same as the possible element classes. I.e. T8\\_ECLASS\\_VERTEX, T8\\_ECLASS\\_TET, etc...""" -const t8_element_shape_t = t8_eclass_t - """ - t8_element_face_shape(ts, elem, face) + p4est_connectivity_encode_t -Compute the shape of the face of an element. +Typedef for serialization method. -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element. -* `face`:\\[in\\] A face of *elem*. -# Returns -The element shape of the face. I.e. T8\\_ECLASS\\_LINE for quads, T8\\_ECLASS\\_TRIANGLE for tets and depending on the face number either T8\\_ECLASS\\_QUAD or T8\\_ECLASS\\_TRIANGLE for prisms. -### Prototype -```c -t8_element_shape_t t8_element_face_shape (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face); -``` +| Enumerator | Note | +| :--------------------------- | :-------------------------------- | +| P4EST\\_CONN\\_ENCODE\\_LAST | Invalid entry to close the list. | """ -function t8_element_face_shape(ts, elem, face) - @ccall libt8.t8_element_face_shape(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, face::Cint)::t8_element_shape_t +@cenum p4est_connectivity_encode_t::UInt32 begin + P4EST_CONN_ENCODE_NONE = 0 + P4EST_CONN_ENCODE_LAST = 1 end """ - t8_element_children_at_face(ts, elem, face, children, num_children, child_indices) + p4est_connect_type_int(btype) -Given an element and a face of the element, compute all children of the element that touch the face. +Convert the [`p4est_connect_type_t`](@ref) into a number. # Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element. -* `face`:\\[in\\] A face of *elem*. -* `children`:\\[in,out\\] Allocated elements, in which the children of *elem* that share a face with *face* are stored. They will be stored in order of their linear id. -* `num_children`:\\[in\\] The number of elements in *children*. Must match the number of children that touch *face*. t8_element_num_face_children -* `child_indices`:\\[in,out\\] If not NULL, an array of num\\_children integers must be given, on output its i-th entry is the child\\_id of the i-th face\\_child. It is valid to call this function with elem = children[0]. +* `btype`:\\[in\\] The balance type to convert. +# Returns +Returns 1 or 2. ### Prototype ```c -void t8_element_children_at_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, t8_element_t *children[], int num_children, int *child_indices); +int p4est_connect_type_int (p4est_connect_type_t btype); ``` """ -function t8_element_children_at_face(ts, elem, face, children, num_children, child_indices) - @ccall libt8.t8_element_children_at_face(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, face::Cint, children::Ptr{Ptr{t8_element_t}}, num_children::Cint, child_indices::Ptr{Cint})::Cvoid +function p4est_connect_type_int(btype) + @ccall libt8.p4est_connect_type_int(btype::p4est_connect_type_t)::Cint end """ - t8_element_face_child_face(ts, elem, face, face_child) - -Given a face of an element and a child number of a child of that face, return the face number of the child of the element that matches the child face. + p4est_connect_type_string(btype) -```c++ - x ---- x x x x ---- x - | | | | | | | <-- f - | | | x | x--x - | | | | | - x ---- x x x ---- x - elem face face_child Returns the face number f -``` +Convert the [`p4est_connect_type_t`](@ref) into a const string. # Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element. -* `face`:\\[in\\] Then number of the face. -* `face_child`:\\[in\\] A number 0 <= *face_child* < num\\_face\\_children, specifying a child of *elem* that shares a face with *face*. These children are counted in linear order. This coincides with the order of children from a call to t8_element_children_at_face. +* `btype`:\\[in\\] The balance type to convert. # Returns -The face number of the face of a child of *elem* that coincides with *face_child*. +Returns a pointer to a constant string. ### Prototype ```c -int t8_element_face_child_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face, int face_child); +const char *p4est_connect_type_string (p4est_connect_type_t btype); ``` """ -function t8_element_face_child_face(ts, elem, face, face_child) - @ccall libt8.t8_element_face_child_face(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, face::Cint, face_child::Cint)::Cint +function p4est_connect_type_string(btype) + @ccall libt8.p4est_connect_type_string(btype::p4est_connect_type_t)::Cstring end """ - t8_element_face_parent_face(ts, elem, face) + p4est_connectivity -Given a face of an element return the face number of the parent of the element that matches the element's face. Or return -1 if no face of the parent matches the face. +This structure holds the 2D inter-tree connectivity information. Identification of arbitrary faces and corners is possible. -!!! note +The arrays tree\\_to\\_* are stored in z ordering. For corners the order wrt. yx is 00 01 10 11. For faces the order is given by the normal directions -x +x -y +y. Each face has a natural direction by increasing face corner number. Face connections are allocated [0][0]..[0][3]..[num\\_trees-1][0]..[num\\_trees-1][3]. If a face is on the physical boundary it must connect to itself. - For the root element this function always returns *face*. +The values for tree\\_to\\_face are 0..7 where ttf % 4 gives the face number and ttf / 4 the face orientation code. The orientation is 0 for faces that are mutually direction-aligned and 1 for faces that are running in opposite directions. -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element. -* `face`:\\[in\\] Then number of the face. -# Returns -If *face* of *elem* is also a face of *elem*'s parent, the face number of this face. Otherwise -1. -### Prototype -```c -int t8_element_face_parent_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face); -``` +It is valid to specify num\\_vertices as 0. In this case vertices and tree\\_to\\_vertex are set to NULL. Otherwise the vertex coordinates are stored in the array vertices as [0][0]..[0][2]..[num\\_vertices-1][0]..[num\\_vertices-1][2]. Vertex coordinates are optional and not used for inferring topology. + +The corners are stored when they connect trees that are not already face neighbors at that specific corner. In this case tree\\_to\\_corner indexes into *ctt_offset*. Otherwise the tree\\_to\\_corner entry must be -1 and this corner is ignored. If num\\_corners == 0, tree\\_to\\_corner and corner\\_to\\_* arrays are set to NULL. + +The arrays corner\\_to\\_* store a variable number of entries per corner. For corner c these are at position [ctt\\_offset[c]]..[ctt\\_offset[c+1]-1]. Their number for corner c is ctt\\_offset[c+1] - ctt\\_offset[c]. The entries encode all trees adjacent to corner c. The size of the corner\\_to\\_* arrays is num\\_ctt = ctt\\_offset[num\\_corners]. + +The *\\_to\\_attr arrays may have arbitrary contents defined by the user. We do not interpret them. + +!!! note + + If a connectivity implies natural connections between trees that are corner neighbors without being face neighbors, these corners shall be encoded explicitly in the connectivity. + +| Field | Note | +| :------------------- | :----------------------------------------------------------------------------------- | +| num\\_vertices | the number of vertices that define the *embedding* of the forest (not the topology) | +| num\\_trees | the number of trees | +| num\\_corners | the number of corners that help define topology | +| vertices | an array of size (3 * *num_vertices*) | +| tree\\_to\\_vertex | embed each tree into ```c++ R^3 ``` for e.g. visualization (see p4est\\_vtk.h) | +| tree\\_attr\\_bytes | bytes per tree in tree\\_to\\_attr | +| tree\\_to\\_attr | not touched by p4est | +| tree\\_to\\_tree | (4 * *num_trees*) neighbors across faces | +| tree\\_to\\_face | (4 * *num_trees*) face to face+orientation (see description) | +| tree\\_to\\_corner | (4 * *num_trees*) or NULL (see description) | +| ctt\\_offset | corner to offset in *corner_to_tree* and *corner_to_corner* | +| corner\\_to\\_tree | list of trees that meet at a corner | +| corner\\_to\\_corner | list of tree-corners that meet at a corner | """ -function t8_element_face_parent_face(ts, elem, face) - @ccall libt8.t8_element_face_parent_face(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, face::Cint)::Cint +struct p4est_connectivity + num_vertices::p4est_topidx_t + num_trees::p4est_topidx_t + num_corners::p4est_topidx_t + vertices::Ptr{Cdouble} + tree_to_vertex::Ptr{p4est_topidx_t} + tree_attr_bytes::Csize_t + tree_to_attr::Cstring + tree_to_tree::Ptr{p4est_topidx_t} + tree_to_face::Ptr{Int8} + tree_to_corner::Ptr{p4est_topidx_t} + ctt_offset::Ptr{p4est_topidx_t} + corner_to_tree::Ptr{p4est_topidx_t} + corner_to_corner::Ptr{Int8} end """ - t8_element_tree_face(ts, elem, face) +This structure holds the 2D inter-tree connectivity information. Identification of arbitrary faces and corners is possible. -Given an element and a face of this element. If the face lies on the tree boundary, return the face number of the tree face. If not the return value is arbitrary. +The arrays tree\\_to\\_* are stored in z ordering. For corners the order wrt. yx is 00 01 10 11. For faces the order is given by the normal directions -x +x -y +y. Each face has a natural direction by increasing face corner number. Face connections are allocated [0][0]..[0][3]..[num\\_trees-1][0]..[num\\_trees-1][3]. If a face is on the physical boundary it must connect to itself. + +The values for tree\\_to\\_face are 0..7 where ttf % 4 gives the face number and ttf / 4 the face orientation code. The orientation is 0 for faces that are mutually direction-aligned and 1 for faces that are running in opposite directions. + +It is valid to specify num\\_vertices as 0. In this case vertices and tree\\_to\\_vertex are set to NULL. Otherwise the vertex coordinates are stored in the array vertices as [0][0]..[0][2]..[num\\_vertices-1][0]..[num\\_vertices-1][2]. Vertex coordinates are optional and not used for inferring topology. + +The corners are stored when they connect trees that are not already face neighbors at that specific corner. In this case tree\\_to\\_corner indexes into *ctt_offset*. Otherwise the tree\\_to\\_corner entry must be -1 and this corner is ignored. If num\\_corners == 0, tree\\_to\\_corner and corner\\_to\\_* arrays are set to NULL. + +The arrays corner\\_to\\_* store a variable number of entries per corner. For corner c these are at position [ctt\\_offset[c]]..[ctt\\_offset[c+1]-1]. Their number for corner c is ctt\\_offset[c+1] - ctt\\_offset[c]. The entries encode all trees adjacent to corner c. The size of the corner\\_to\\_* arrays is num\\_ctt = ctt\\_offset[num\\_corners]. + +The *\\_to\\_attr arrays may have arbitrary contents defined by the user. We do not interpret them. + +!!! note + + If a connectivity implies natural connections between trees that are corner neighbors without being face neighbors, these corners shall be encoded explicitly in the connectivity. +""" +const p4est_connectivity_t = p4est_connectivity + +""" + p4est_connectivity_memory_used(conn) + +Calculate memory usage of a connectivity structure. # Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in\\] The element. -* `face`:\\[in\\] The index of a face of *elem*. +* `conn`:\\[in\\] Connectivity structure. # Returns -The index of the tree face that *face* is a subface of, if *face* is on a tree boundary. Any arbitrary integer if *is* not at a tree boundary. +Memory used in bytes. ### Prototype ```c -int t8_element_tree_face (const t8_eclass_scheme_c *ts, const t8_element_t *elem, int face); +size_t p4est_connectivity_memory_used (p4est_connectivity_t * conn); ``` """ -function t8_element_tree_face(ts, elem, face) - @ccall libt8.t8_element_tree_face(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t}, face::Cint)::Cint +function p4est_connectivity_memory_used(conn) + @ccall libt8.p4est_connectivity_memory_used(conn::Ptr{p4est_connectivity_t})::Csize_t end """ - t8_element_transform_face(ts, elem1, elem2, orientation, sign, is_smaller_face) + p4est_corner_transform_t -Suppose we have two trees that share a common face f. Given an element e that is a subface of f in one of the trees and given the orientation of the tree connection, construct the face element of the respective tree neighbor that logically coincides with e but lies in the coordinate system of the neighbor tree. +Generic interface for transformations between a tree and any of its corner -!!! note +| Field | Note | +| :------ | :------------------------ | +| ntree | The number of the tree | +| ncorner | The number of the corner | +""" +struct p4est_corner_transform_t + ntree::p4est_topidx_t + ncorner::Int8 +end - *elem1* and *elem2* may point to the same element. +""" + p4est_corner_info_t -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem1`:\\[in\\] The face element. -* `elem2`:\\[in,out\\] On return the face element *elem1* with respect to the coordinate system of the other tree. -* `orientation`:\\[in\\] The orientation of the tree-tree connection. -* `sign`:\\[in\\] Depending on the topological orientation of the two tree faces, either 0 (both faces have opposite orientation) or 1 (both faces have the same top. orientattion). t8_eclass_face_orientation -* `is_smaller_face`:\\[in\\] Flag to declare whether *elem1* belongs to the smaller face. A face f of tree T is smaller than f' of T' if either the eclass of T is smaller or if the classes are equal and f*\\_to\\_attr fields must either be NULL or previously be allocated by this function. +* `bytes_per_tree`:\\[in\\] If 0, tree\\_to\\_attr is freed (being NULL is ok). If positive, requested space is allocated. ### Prototype ```c -void t8_element_successor (const t8_eclass_scheme_c *ts, const t8_element_t *elem1, t8_element_t *elem2); +void p4est_connectivity_set_attr (p4est_connectivity_t * conn, size_t bytes_per_tree); ``` """ -function t8_element_successor(ts, elem1, elem2) - @ccall libt8.t8_element_successor(ts::Ptr{t8_eclass_scheme_c}, elem1::Ptr{t8_element_t}, elem2::Ptr{t8_element_t})::Cvoid +function p4est_connectivity_set_attr(conn, bytes_per_tree) + @ccall libt8.p4est_connectivity_set_attr(conn::Ptr{p4est_connectivity_t}, bytes_per_tree::Csize_t)::Cvoid end """ - t8_element_vertex_reference_coords(ts, t, vertex, coords) + p4est_connectivity_is_valid(connectivity) -Compute the coordinates of a given element vertex inside a reference tree that is embedded into [0,1]^d (d = dimension). - -!!! warning - - coords should be zero-initialized, as only the first d coords will be set, but when used elsewhere all coords might be used. +Examine a connectivity structure. -# Arguments -* `t`:\\[in\\] The element to be considered. -* `vertex`:\\[in\\] The id of the vertex whose coordinates shall be computed. -* `coords`:\\[out\\] An array of at least as many doubles as the element's dimension whose entries will be filled with the coordinates of *vertex*. +# Returns +Returns true if structure is valid, false otherwise. ### Prototype ```c -void t8_element_vertex_reference_coords (const t8_eclass_scheme_c *ts, const t8_element_t *t, const int vertex, double coords[]); +int p4est_connectivity_is_valid (p4est_connectivity_t * connectivity); ``` """ -function t8_element_vertex_reference_coords(ts, t, vertex, coords) - @ccall libt8.t8_element_vertex_reference_coords(ts::Ptr{t8_eclass_scheme_c}, t::Ptr{t8_element_t}, vertex::Cint, coords::Ptr{Cdouble})::Cvoid +function p4est_connectivity_is_valid(connectivity) + @ccall libt8.p4est_connectivity_is_valid(connectivity::Ptr{p4est_connectivity_t})::Cint end """ - t8_element_count_leaves(ts, t, level) - -Count how many leaf descendants of a given uniform level an element would produce. + p4est_connectivity_is_equal(conn1, conn2) -Example: If *t* is a line element that refines into 2 line elements on each level, then the return value is max(0, 2^{*level* - level(*t*)}). Thus, if *t*'s level is 0, and *level* = 3, the return value is 2^3 = 8. +Check two connectivity structures for equality. -# Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `t`:\\[in\\] The element to be checked. -* `level`:\\[in\\] A refinement level. # Returns -Suppose *t* is uniformly refined up to level *level*. The return value is the resulting number of elements (of the given level). If *level* < [`t8_element_level`](@ref)(t), the return value should be 0. +Returns true if structures are equal, false otherwise. ### Prototype ```c -t8_gloidx_t t8_element_count_leaves (const t8_eclass_scheme_c *ts, const t8_element_t *t, int level); +int p4est_connectivity_is_equal (p4est_connectivity_t * conn1, p4est_connectivity_t * conn2); ``` """ -function t8_element_count_leaves(ts, t, level) - @ccall libt8.t8_element_count_leaves(ts::Ptr{t8_eclass_scheme_c}, t::Ptr{t8_element_t}, level::Cint)::t8_gloidx_t +function p4est_connectivity_is_equal(conn1, conn2) + @ccall libt8.p4est_connectivity_is_equal(conn1::Ptr{p4est_connectivity_t}, conn2::Ptr{p4est_connectivity_t})::Cint end """ - t8_element_count_leaves_from_root(ts, level) - -Count how many leaf descendants of a given uniform level the root element will produce. + p4est_connectivity_sink(conn, sink) -This is a convenience function, and can be implemented via t8_element_count_leaves. +Write connectivity to a sink object. # Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `level`:\\[in\\] A refinement level. +* `conn`:\\[in\\] The connectivity to be written. +* `sink`:\\[in,out\\] The connectivity is written into this sink. # Returns -The value of t8_element_count_leaves if the input element is the root (level 0) element. +0 on success, nonzero on error. ### Prototype ```c -t8_gloidx_t t8_element_count_leaves_from_root (const t8_eclass_scheme_c *ts, int level); +int p4est_connectivity_sink (p4est_connectivity_t * conn, sc_io_sink_t * sink); ``` """ -function t8_element_count_leaves_from_root(ts, level) - @ccall libt8.t8_element_count_leaves_from_root(ts::Ptr{t8_eclass_scheme_c}, level::Cint)::t8_gloidx_t +function p4est_connectivity_sink(conn, sink) + @ccall libt8.p4est_connectivity_sink(conn::Ptr{p4est_connectivity_t}, sink::Ptr{sc_io_sink_t})::Cint end """ - t8_element_new(ts, length, elems) - -Allocate memory for an array of elements of a given class and initialize them. - -!!! note - - Not every element that is created in t8code will be created by a call to this function. However, if an element is not created using t8_element_new, then it is guaranteed that t8_element_init is called on it. - -!!! note - - In debugging mode, an element that was created with t8_element_new must pass t8_element_is_valid. - -!!! note + p4est_connectivity_deflate(conn, code) - If an element was created by t8_element_new then t8_element_init may not be called for it. Thus, t8_element_new should initialize an element in the same way as a call to t8_element_init would. +Allocate memory and store the connectivity information there. # Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `length`:\\[in\\] The number of elements to be allocated. -* `elems`:\\[in,out\\] On input an array of **length** many unallocated element pointers. On output all these pointers will point to an allocated and initialized element. -# See also -t8\\_element\\_init, t8\\_element\\_is\\_valid - +* `conn`:\\[in\\] The connectivity structure to be exported to memory. +* `code`:\\[in\\] Encoding and compression method for serialization. +# Returns +Newly created array that contains the information. ### Prototype ```c -void t8_element_new (const t8_eclass_scheme_c *ts, int length, t8_element_t **elems); +sc_array_t *p4est_connectivity_deflate (p4est_connectivity_t * conn, p4est_connectivity_encode_t code); ``` """ -function t8_element_new(ts, length, elems) - @ccall libt8.t8_element_new(ts::Ptr{t8_eclass_scheme_c}, length::Cint, elems::Ptr{Ptr{t8_element_t}})::Cvoid +function p4est_connectivity_deflate(conn, code) + @ccall libt8.p4est_connectivity_deflate(conn::Ptr{p4est_connectivity_t}, code::p4est_connectivity_encode_t)::Ptr{sc_array_t} end """ - t8_element_destroy(ts, length, elems) + p4est_connectivity_save(filename, connectivity) -Deallocate an array of elements. +Save a connectivity structure to disk. # Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `length`:\\[in\\] The number of elements in the array. -* `elems`:\\[in,out\\] On input an array of **length** many allocated element pointers. On output all these pointers will be freed. **elem** itself will not be freed by this function. +* `filename`:\\[in\\] Name of the file to write. +* `connectivity`:\\[in\\] Valid connectivity structure. +# Returns +Returns 0 on success, nonzero on file error. ### Prototype ```c -void t8_element_destroy (const t8_eclass_scheme_c *ts, int length, t8_element_t **elems); +int p4est_connectivity_save (const char *filename, p4est_connectivity_t * connectivity); ``` """ -function t8_element_destroy(ts, length, elems) - @ccall libt8.t8_element_destroy(ts::Ptr{t8_eclass_scheme_c}, length::Cint, elems::Ptr{Ptr{t8_element_t}})::Cvoid +function p4est_connectivity_save(filename, connectivity) + @ccall libt8.p4est_connectivity_save(filename::Cstring, connectivity::Ptr{p4est_connectivity_t})::Cint end """ - t8_element_root(ts, elem) + p4est_connectivity_source(source) -Fills an element with the root element. +Read connectivity from a source object. # Arguments -* `ts`:\\[in\\] Implementation of a class scheme. -* `elem`:\\[in,out\\] The element to be filled with root. +* `source`:\\[in,out\\] The connectivity is read from this source. +# Returns +The newly created connectivity, or NULL on error. ### Prototype ```c -void t8_element_root (const t8_eclass_scheme_c *ts, t8_element_t *elem); +p4est_connectivity_t *p4est_connectivity_source (sc_io_source_t * source); ``` """ -function t8_element_root(ts, elem) - @ccall libt8.t8_element_root(ts::Ptr{t8_eclass_scheme_c}, elem::Ptr{t8_element_t})::Cvoid +function p4est_connectivity_source(source) + @ccall libt8.p4est_connectivity_source(source::Ptr{sc_io_source_t})::Ptr{p4est_connectivity_t} end """ - t8_element_MPI_Pack(ts, elements, count, send_buffer, buffer_size, position, comm) + p4est_connectivity_inflate(buffer) + +Create new connectivity from a memory buffer. This function aborts on malloc errors. +# Arguments +* `buffer`:\\[in\\] The connectivity is created from this memory buffer. +# Returns +The newly created connectivity, or NULL on format error of the buffered connectivity data. ### Prototype ```c -void t8_element_MPI_Pack (const t8_eclass_scheme_c *ts, t8_element_t **const elements, const unsigned int count, void *send_buffer, const int buffer_size, int *position, sc_MPI_Comm comm); +p4est_connectivity_t *p4est_connectivity_inflate (sc_array_t * buffer); ``` """ -function t8_element_MPI_Pack(ts, elements, count, send_buffer, buffer_size, position, comm) - @ccall libt8.t8_element_MPI_Pack(ts::Ptr{t8_eclass_scheme_c}, elements::Ptr{Ptr{t8_element_t}}, count::Cuint, send_buffer::Ptr{Cvoid}, buffer_size::Cint, position::Ptr{Cint}, comm::MPI_Comm)::Cvoid +function p4est_connectivity_inflate(buffer) + @ccall libt8.p4est_connectivity_inflate(buffer::Ptr{sc_array_t})::Ptr{p4est_connectivity_t} end """ - t8_element_MPI_Pack_size(ts, count, comm, pack_size) + p4est_connectivity_load(filename, bytes) +Load a connectivity structure from disk. + +# Arguments +* `filename`:\\[in\\] Name of the file to read. +* `bytes`:\\[in,out\\] Size in bytes of connectivity on disk or NULL. +# Returns +Returns valid connectivity, or NULL on file error. ### Prototype ```c -void t8_element_MPI_Pack_size (const t8_eclass_scheme_c *ts, const unsigned int count, sc_MPI_Comm comm, int *pack_size); +p4est_connectivity_t *p4est_connectivity_load (const char *filename, size_t *bytes); ``` """ -function t8_element_MPI_Pack_size(ts, count, comm, pack_size) - @ccall libt8.t8_element_MPI_Pack_size(ts::Ptr{t8_eclass_scheme_c}, count::Cuint, comm::MPI_Comm, pack_size::Ptr{Cint})::Cvoid +function p4est_connectivity_load(filename, bytes) + @ccall libt8.p4est_connectivity_load(filename::Cstring, bytes::Ptr{Csize_t})::Ptr{p4est_connectivity_t} end """ - t8_element_MPI_Unpack(ts, recvbuf, buffer_size, position, elements, count, comm) + p4est_connectivity_new_unitsquare() + +Create a connectivity structure for the unit square. ### Prototype ```c -void t8_element_MPI_Unpack (const t8_eclass_scheme_c *ts, void *recvbuf, const int buffer_size, int *position, t8_element_t **elements, const unsigned int count, sc_MPI_Comm comm); +p4est_connectivity_t *p4est_connectivity_new_unitsquare (void); ``` """ -function t8_element_MPI_Unpack(ts, recvbuf, buffer_size, position, elements, count, comm) - @ccall libt8.t8_element_MPI_Unpack(ts::Ptr{t8_eclass_scheme_c}, recvbuf::Ptr{Cvoid}, buffer_size::Cint, position::Ptr{Cint}, elements::Ptr{Ptr{t8_element_t}}, count::Cuint, comm::MPI_Comm)::Cvoid +function p4est_connectivity_new_unitsquare() + @ccall libt8.p4est_connectivity_new_unitsquare()::Ptr{p4est_connectivity_t} end """ - t8_element_shape_num_faces(element_shape) + p4est_connectivity_new_periodic() -The number of codimension-one boundaries of an element class. +Create a connectivity structure for an all-periodic unit square. ### Prototype ```c -int t8_element_shape_num_faces (int element_shape); +p4est_connectivity_t *p4est_connectivity_new_periodic (void); ``` """ -function t8_element_shape_num_faces(element_shape) - @ccall libt8.t8_element_shape_num_faces(element_shape::Cint)::Cint +function p4est_connectivity_new_periodic() + @ccall libt8.p4est_connectivity_new_periodic()::Ptr{p4est_connectivity_t} end """ - t8_element_shape_max_num_faces(element_shape) + p4est_connectivity_new_rotwrap() -For each dimension the maximum possible number of faces of an element\\_shape of that dimension. +Create a connectivity structure for a periodic unit square. The left and right faces are identified, and bottom and top opposite. ### Prototype ```c -int t8_element_shape_max_num_faces (int element_shape); +p4est_connectivity_t *p4est_connectivity_new_rotwrap (void); ``` """ -function t8_element_shape_max_num_faces(element_shape) - @ccall libt8.t8_element_shape_max_num_faces(element_shape::Cint)::Cint +function p4est_connectivity_new_rotwrap() + @ccall libt8.p4est_connectivity_new_rotwrap()::Ptr{p4est_connectivity_t} end """ - t8_element_shape_num_vertices(element_shape) + p4est_connectivity_new_circle() -The number of vertices of an element class. +Create a connectivity structure for an donut-like circle. The circle consists of 6 trees connecting each other by their faces. The trees are laid out as a hexagon between [-2, 2] in the y direction and [-sqrt(3), sqrt(3)] in the x direction. The hexagon has flat sides along the y direction and pointy ends in x. ### Prototype ```c -int t8_element_shape_num_vertices (int element_shape); +p4est_connectivity_t *p4est_connectivity_new_circle (void); ``` """ -function t8_element_shape_num_vertices(element_shape) - @ccall libt8.t8_element_shape_num_vertices(element_shape::Cint)::Cint +function p4est_connectivity_new_circle() + @ccall libt8.p4est_connectivity_new_circle()::Ptr{p4est_connectivity_t} end """ - t8_element_shape_vtk_type(element_shape) + p4est_connectivity_new_drop() -The vtk cell type for the element\\_shape +Create a connectivity structure for a five-trees geometry with a hole. The geometry covers the square [0, 3]**2, where the hole is [1, 2]**2. ### Prototype ```c -int t8_element_shape_vtk_type (int element_shape); +p4est_connectivity_t *p4est_connectivity_new_drop (void); ``` """ -function t8_element_shape_vtk_type(element_shape) - @ccall libt8.t8_element_shape_vtk_type(element_shape::Cint)::Cint +function p4est_connectivity_new_drop() + @ccall libt8.p4est_connectivity_new_drop()::Ptr{p4est_connectivity_t} end """ - t8_element_shape_vtk_corner_number(element_shape, index) + p4est_connectivity_new_twotrees(l_face, r_face, orientation) -Maps the t8code corner number of the element to the vtk corner number +Create a connectivity structure for two trees being rotated w.r.t. each other in a user-defined way +# Arguments +* `l_face`:\\[in\\] index of left face +* `r_face`:\\[in\\] index of right face +* `orientation`:\\[in\\] orientation of trees w.r.t. each other ### Prototype ```c -int t8_element_shape_vtk_corner_number (int element_shape, int index); +p4est_connectivity_t *p4est_connectivity_new_twotrees (int l_face, int r_face, int orientation); ``` """ -function t8_element_shape_vtk_corner_number(element_shape, index) - @ccall libt8.t8_element_shape_vtk_corner_number(element_shape::Cint, index::Cint)::Cint +function p4est_connectivity_new_twotrees(l_face, r_face, orientation) + @ccall libt8.p4est_connectivity_new_twotrees(l_face::Cint, r_face::Cint, orientation::Cint)::Ptr{p4est_connectivity_t} end """ - t8_element_shape_to_string(element_shape) + p4est_connectivity_new_corner() -For each element\\_shape, the name of this class as a string +Create a connectivity structure for a three-tree mesh around a corner. ### Prototype ```c -const char* t8_element_shape_to_string (int element_shape); +p4est_connectivity_t *p4est_connectivity_new_corner (void); ``` """ -function t8_element_shape_to_string(element_shape) - @ccall libt8.t8_element_shape_to_string(element_shape::Cint)::Cstring +function p4est_connectivity_new_corner() + @ccall libt8.p4est_connectivity_new_corner()::Ptr{p4est_connectivity_t} end """ - t8_element_shape_compare(element_shape1, element_shape2) + p4est_connectivity_new_pillow() -Compare two element\\_shapees of the same dimension as necessary for face neighbor orientation. The implemented order is Triangle < Square in 2D and Tet < Hex < Prism < Pyramid in 3D. +Create a connectivity structure for two trees on top of each other. -# Arguments -* `element_shape1`:\\[in\\] The first element\\_shape to compare. -* `element_shape2`:\\[in\\] The second element\\_shape to compare. -# Returns -0 if the element\\_shapees are equal, 1 if element\\_shape1 > element\\_shape2 and -1 if element\\_shape1 < element\\_shape2 ### Prototype ```c -int t8_element_shape_compare (t8_element_shape_t element_shape1, t8_element_shape_t element_shape2); +p4est_connectivity_t *p4est_connectivity_new_pillow (void); ``` """ -function t8_element_shape_compare(element_shape1, element_shape2) - @ccall libt8.t8_element_shape_compare(element_shape1::t8_element_shape_t, element_shape2::t8_element_shape_t)::Cint +function p4est_connectivity_new_pillow() + @ccall libt8.p4est_connectivity_new_pillow()::Ptr{p4est_connectivity_t} end """ - t8_forest - -| Field | Note | -| :---------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| rc | Reference counter. | -| set\\_level | Level to use in new construction. | -| set\\_for\\_coarsening | Change partition to allow for one round of coarsening | -| cmesh | Coarse mesh to use. | -| scheme\\_cxx | Scheme for element types. | -| maxlevel | The maximum allowed refinement level for elements in this forest. | -| maxlevel\\_existing | If >= 0, the maximum occurring refinemnent level of a forest element. | -| do\\_dup | Communicator shall be duped. | -| dimension | Dimension inferred from **cmesh**. | -| incomplete\\_trees | Flag to check whether the forest has (potential) incomplete trees. A tree is incomplete if an element has been removed from it. Once an element got removed, the flag sets to 1 (true) and stays. For a committed forest this flag is either true on all ranks or false on all ranks. | -| set\\_from | Temporarily store source forest. | -| from\\_method | Method to derive from **set_from**. | -| set\\_adapt\\_fn | refinement and coarsen function. Called when **from_method** is set to [`T8_FOREST_FROM_ADAPT`](@ref). | -| set\\_adapt\\_recursive | Flag to decide whether coarsen and refine are carried out recursive | -| set\\_balance | Flag to decide whether to forest will be balance in t8_forest_commit. See t8_forest_set_balance. If 0, no balance. If 1 balance with repartitioning, if 2 balance without repartitioning, # See also [`t8_forest_balance`](@ref) | -| do\\_ghost | If True, a ghost layer will be created when the forest is committed. | -| ghost\\_type | If a ghost layer will be created, the type of neighbors that count as ghost. | -| ghost\\_algorithm | Controls the algorithm used for ghost. 1 = balanced only. 2 = also unbalanced 3 = top-down search and unbalanced. | -| user\\_data | Pointer for arbitrary user data. # See also [`t8_forest_set_user_data`](@ref). | -| user\\_function | Pointer for arbitrary user function. # See also [`t8_forest_set_user_function`](@ref). | -| t8code\\_data | Pointer for arbitrary data that is used internally. | -| committed | t8_forest_commit called? | -| mpisize | Number of MPI processes. | -| mpirank | Number of this MPI process. | -| first\\_local\\_tree | The global index of the first local tree on this process. If first\\_local\\_tree is larger than last\\_local\\_tree then this processor/forest is empty. See https://github.com/DLR-AMR/t8code/wiki/Tree-indexing | -| last\\_local\\_tree | The global index of the last local tree on this process. -1 if this processor is empty. | -| global\\_num\\_trees | The total number of global trees | -| ghosts | If not NULL, the ghost elements. # See also [`t8_forest_ghost`](@ref).h | -| element\\_offsets | If partitioned, for each process the global index of its first element. Since it is memory consuming, it is usually only constructed when needed and otherwise unallocated. | -| global\\_first\\_desc | If partitioned, for each process the linear id (at maxlevel) of its first element's first descendant. t8_element_set_linear_id. Stores 0 for empty processes. Since it is memory consuming, it is usually only constructed when needed and otherwise unallocated. | -| tree\\_offsets | If partitioned for each process the global index of its first local tree or -(first local tree) - 1 if the first tree on that process is shared. Since this is memory consuming we only construct it when needed. This array follows the same logic as *tree_offsets* in [`t8_cmesh_t`](@ref) | -| local\\_num\\_elements | Number of elements on this processor. | -| global\\_num\\_elements | Number of elements on all processors. | -| profile | If not NULL, runtimes and statistics about forest\\_commit are stored here. | -""" -# struct t8_forest -# rc::t8_refcount_t -# set_level::Cint -# set_for_coarsening::Cint -# mpicomm::MPI_Comm -# cmesh::t8_cmesh_t -# scheme_cxx::Ptr{t8_scheme_cxx_t} -# maxlevel::Cint -# maxlevel_existing::Cint -# do_dup::Cint -# dimension::Cint -# incomplete_trees::Cint -# set_from::t8_forest_t -# from_method::t8_forest_from_t -# set_adapt_fn::t8_forest_adapt_t -# set_adapt_recursive::Cint -# set_balance::Cint -# do_ghost::Cint -# ghost_type::t8_ghost_type_t -# ghost_algorithm::Cint -# user_data::Ptr{Cvoid} -# user_function::Ptr{Cvoid} -# t8code_data::Ptr{Cvoid} -# committed::Cint -# mpisize::Cint -# mpirank::Cint -# first_local_tree::t8_gloidx_t -# last_local_tree::t8_gloidx_t -# global_num_trees::t8_gloidx_t -# trees::Ptr{sc_array_t} -# ghosts::t8_forest_ghost_t -# element_offsets::t8_shmem_array_t -# global_first_desc::t8_shmem_array_t -# tree_offsets::t8_shmem_array_t -# local_num_elements::t8_locidx_t -# global_num_elements::t8_gloidx_t -# profile::Ptr{t8_profile_t} -# stats::NTuple{14, sc_statinfo_t} -# stats_computed::Cint -# end - -# This struct is not supposed to be read and modified directly. -# Besides, there is a circular dependency with `t8_forest_t` -# leading to an error output by Julia. -mutable struct t8_forest end - -"""Opaque pointer to a forest implementation.""" -const t8_forest_t = Ptr{t8_forest} + p4est_connectivity_new_moebius() -""" - t8_forest_write_netcdf(forest, file_prefix, file_title, dim, num_extern_netcdf_vars, ext_variables, comm) +Create a connectivity structure for a five-tree moebius band. ### Prototype ```c -void t8_forest_write_netcdf (t8_forest_t forest, const char *file_prefix, const char *file_title, int dim, int num_extern_netcdf_vars, t8_netcdf_variable_t *ext_variables[], sc_MPI_Comm comm); +p4est_connectivity_t *p4est_connectivity_new_moebius (void); ``` """ -function t8_forest_write_netcdf(forest, file_prefix, file_title, dim, num_extern_netcdf_vars, ext_variables, comm) - @ccall libt8.t8_forest_write_netcdf(forest::t8_forest_t, file_prefix::Cstring, file_title::Cstring, dim::Cint, num_extern_netcdf_vars::Cint, ext_variables::Ptr{Ptr{t8_netcdf_variable_t}}, comm::MPI_Comm)::Cvoid +function p4est_connectivity_new_moebius() + @ccall libt8.p4est_connectivity_new_moebius()::Ptr{p4est_connectivity_t} end """ - t8_forest_write_netcdf_ext(forest, file_prefix, file_title, dim, num_extern_netcdf_vars, ext_variables, comm, netcdf_var_storage_mode, netcdf_var_mpi_access) + p4est_connectivity_new_star() + +Create a connectivity structure for a six-tree star. ### Prototype ```c -void t8_forest_write_netcdf_ext (t8_forest_t forest, const char *file_prefix, const char *file_title, int dim, int num_extern_netcdf_vars, t8_netcdf_variable_t *ext_variables[], sc_MPI_Comm comm, int netcdf_var_storage_mode, int netcdf_var_mpi_access); +p4est_connectivity_t *p4est_connectivity_new_star (void); ``` """ -function t8_forest_write_netcdf_ext(forest, file_prefix, file_title, dim, num_extern_netcdf_vars, ext_variables, comm, netcdf_var_storage_mode, netcdf_var_mpi_access) - @ccall libt8.t8_forest_write_netcdf_ext(forest::t8_forest_t, file_prefix::Cstring, file_title::Cstring, dim::Cint, num_extern_netcdf_vars::Cint, ext_variables::Ptr{Ptr{t8_netcdf_variable_t}}, comm::MPI_Comm, netcdf_var_storage_mode::Cint, netcdf_var_mpi_access::Cint)::Cvoid +function p4est_connectivity_new_star() + @ccall libt8.p4est_connectivity_new_star()::Ptr{p4est_connectivity_t} end """ - t8_mat_init_xrot(mat, angle) + p4est_connectivity_new_cubed() -Initialize given 3x3 matrix as rotation matrix around the x-axis with given angle. +Create a connectivity structure for the six sides of a unit cube. The ordering of the trees is as follows: + +0 1 2 3 <-- 3: axis-aligned top side 4 5 + +This choice has been made for maximum symmetry (see tree\\_to\\_* in .c file). -# Arguments -* `mat`:\\[in,out\\] 3x3-matrix. -* `angle`:\\[in\\] Rotation angle in radians. ### Prototype ```c -static inline void t8_mat_init_xrot (double mat[3][3], const double angle); +p4est_connectivity_t *p4est_connectivity_new_cubed (void); ``` """ -function t8_mat_init_xrot(mat, angle) - @ccall libt8.t8_mat_init_xrot(mat::Ptr{NTuple{3, Cdouble}}, angle::Cdouble)::Cvoid +function p4est_connectivity_new_cubed() + @ccall libt8.p4est_connectivity_new_cubed()::Ptr{p4est_connectivity_t} end """ - t8_mat_init_yrot(mat, angle) + p4est_connectivity_new_disk_nonperiodic() -Initialize given 3x3 matrix as rotation matrix around the y-axis with given angle. +Create a connectivity structure for a five-tree flat spherical disk. This disk can just as well be used as a square to test non-Cartesian maps. Without any mapping this connectivity covers the square [-3, 3]**2. -# Arguments -* `mat`:\\[in,out\\] 3x3-matrix. -* `angle`:\\[in\\] Rotation angle in radians. +# Returns +Initialized and usable connectivity. ### Prototype ```c -static inline void t8_mat_init_yrot (double mat[3][3], const double angle); +p4est_connectivity_t *p4est_connectivity_new_disk_nonperiodic (void); ``` """ -function t8_mat_init_yrot(mat, angle) - @ccall libt8.t8_mat_init_yrot(mat::Ptr{NTuple{3, Cdouble}}, angle::Cdouble)::Cvoid +function p4est_connectivity_new_disk_nonperiodic() + @ccall libt8.p4est_connectivity_new_disk_nonperiodic()::Ptr{p4est_connectivity_t} end """ - t8_mat_init_zrot(mat, angle) + p4est_connectivity_new_disk(periodic_a, periodic_b) -Initialize given 3x3 matrix as rotation matrix around the z-axis with given angle. +Create a connectivity structure for a five-tree flat spherical disk. This disk can just as well be used as a square to test non-Cartesian maps. Without any mapping this connectivity covers the square [-3, 3]**2. -# Arguments -* `mat`:\\[in,out\\] 3x3-matrix. -* `angle`:\\[in\\] Rotation angle in radians. -### Prototype -```c -static inline void t8_mat_init_zrot (double mat[3][3], const double angle); -``` -""" -function t8_mat_init_zrot(mat, angle) - @ccall libt8.t8_mat_init_zrot(mat::Ptr{NTuple{3, Cdouble}}, angle::Cdouble)::Cvoid -end +!!! note -""" - t8_mat_mult_vec(mat, a, b) + The API of this function has changed to accept two arguments. You can query the P4EST_CONN_DISK_PERIODIC to check whether the new version with the argument is in effect. -Apply matrix-matrix multiplication: b = M*a. +The ordering of the trees is as follows: + +4 1 2 3 0 + +The outside x faces may be identified topologically. The outside y faces may be identified topologically. Both identifications may be specified simultaneously. The general shape and periodicity are the same as those obtained with p4est_connectivity_new_brick (1, 1, periodic\\_a, periodic\\_b). + +When setting *periodic_a* and *periodic_b* to false, the result is the same as that of p4est_connectivity_new_disk_nonperiodic. # Arguments -* `mat`:\\[in\\] 3x3-matrix. -* `a`:\\[in\\] 3-vector. -* `b`:\\[in,out\\] 3-vector. +* `periodic_a`:\\[in\\] Bool to make disk periodic in x direction. +* `periodic_b`:\\[in\\] Bool to make disk periodic in y direction. +# Returns +Initialized and usable connectivity. ### Prototype ```c -static inline void t8_mat_mult_vec (const double mat[3][3], const double a[3], double b[3]); +p4est_connectivity_t *p4est_connectivity_new_disk (int periodic_a, int periodic_b); ``` """ -function t8_mat_mult_vec(mat, a, b) - @ccall libt8.t8_mat_mult_vec(mat::Ptr{NTuple{3, Cdouble}}, a::Ptr{Cdouble}, b::Ptr{Cdouble})::Cvoid +function p4est_connectivity_new_disk(periodic_a, periodic_b) + @ccall libt8.p4est_connectivity_new_disk(periodic_a::Cint, periodic_b::Cint)::Ptr{p4est_connectivity_t} end """ - t8_mat_mult_mat(A, B, C) + p4est_connectivity_new_icosahedron() -Apply matrix-matrix multiplication: C = A*B. +Create a connectivity for mapping the sphere using an icosahedron. -# Arguments -* `A`:\\[in\\] 3x3-matrix. -* `B`:\\[in\\] 3x3-matrix. -* `C`:\\[in\\] 3x3-matrix. -### Prototype -```c -static inline void t8_mat_mult_mat (const double A[3][3], const double B[3][3], double C[3][3]); -``` -""" -function t8_mat_mult_mat(A, B, C) - @ccall libt8.t8_mat_mult_mat(A::Ptr{NTuple{3, Cdouble}}, B::Ptr{NTuple{3, Cdouble}}, C::Ptr{NTuple{3, Cdouble}})::Cvoid -end - -mutable struct t8_mesh end - -const t8_mesh_t = t8_mesh - -""" - t8_mesh_new(dimension, Kglobal, Klocal) +The regular icosadron is a polyhedron with 20 faces, each of which is an equilateral triangle. To build the p4est connectivity, we group faces 2 by 2 to from 10 quadrangles, and thus 10 trees. -*********************** preallocate ************************* +This connectivity is meant to be used together with p4est_geometry_new_icosahedron to map the sphere. -### Prototype -```c -t8_mesh_t * t8_mesh_new (int dimension, t8_gloidx_t Kglobal, t8_locidx_t Klocal); -``` -""" -function t8_mesh_new(dimension, Kglobal, Klocal) - @ccall libt8.t8_mesh_new(dimension::Cint, Kglobal::t8_gloidx_t, Klocal::t8_locidx_t)::Ptr{t8_mesh_t} -end +The flat connectivity looks like that. Vextex numbering: -""" - t8_mesh_new_unitcube(theclass) +A00 A01 A02 A03 A04 / \\ / \\ / \\ / \\ / \\ A05---A06---A07---A08---A09---A10 \\ / \\ / \\ / \\ / \\ / \\ A11---A12---A13---A14---A15---A16 \\ / \\ / \\ / \\ / \\ / A17 A18 A19 A20 A21 -*********** all-in-one convenience constructors ************* +Origin in A05. -### Prototype -```c -t8_mesh_t * t8_mesh_new_unitcube (t8_eclass_t theclass); -``` -""" -function t8_mesh_new_unitcube(theclass) - @ccall libt8.t8_mesh_new_unitcube(theclass::t8_eclass_t)::Ptr{t8_mesh_t} -end +Tree numbering: -""" - t8_mesh_set_comm(mesh, comm) +0 2 4 6 8 1 3 5 7 9 ### Prototype ```c -void t8_mesh_set_comm (t8_mesh_t *mesh, sc_MPI_Comm comm); +p4est_connectivity_t *p4est_connectivity_new_icosahedron (void); ``` """ -function t8_mesh_set_comm(mesh, comm) - @ccall libt8.t8_mesh_set_comm(mesh::Ptr{t8_mesh_t}, comm::MPI_Comm)::Cvoid +function p4est_connectivity_new_icosahedron() + @ccall libt8.p4est_connectivity_new_icosahedron()::Ptr{p4est_connectivity_t} end """ - t8_mesh_set_partition(mesh, enable) + p4est_connectivity_new_shell2d() -Determine whether we partition in t8_mesh_build. Default true. +Create a connectivity structure that builds a 2d spherical shell. p8est_connectivity_new_shell ### Prototype ```c -void t8_mesh_set_partition (t8_mesh_t *mesh, int enable); +p4est_connectivity_t *p4est_connectivity_new_shell2d (void); ``` """ -function t8_mesh_set_partition(mesh, enable) - @ccall libt8.t8_mesh_set_partition(mesh::Ptr{t8_mesh_t}, enable::Cint)::Cvoid +function p4est_connectivity_new_shell2d() + @ccall libt8.p4est_connectivity_new_shell2d()::Ptr{p4est_connectivity_t} end """ - t8_mesh_set_element(mesh, theclass, gloid, locid) + p4est_connectivity_new_disk2d() -### Prototype -```c -void t8_mesh_set_element (t8_mesh_t *mesh, t8_eclass_t theclass, t8_gloidx_t gloid, t8_locidx_t locid); -``` -""" -function t8_mesh_set_element(mesh, theclass, gloid, locid) - @ccall libt8.t8_mesh_set_element(mesh::Ptr{t8_mesh_t}, theclass::t8_eclass_t, gloid::t8_gloidx_t, locid::t8_locidx_t)::Cvoid -end +Create a connectivity structure that maps a 2d disk. -""" - t8_mesh_set_local_to_global(mesh, ltog_length, ltog) +This is a 5 trees connectivity meant to be used together with p4est_geometry_new_disk2d to map the disk. ### Prototype ```c -void t8_mesh_set_local_to_global (t8_mesh_t *mesh, t8_locidx_t ltog_length, const t8_gloidx_t *ltog); +p4est_connectivity_t *p4est_connectivity_new_disk2d (void); ``` """ -function t8_mesh_set_local_to_global(mesh, ltog_length, ltog) - @ccall libt8.t8_mesh_set_local_to_global(mesh::Ptr{t8_mesh_t}, ltog_length::t8_locidx_t, ltog::Ptr{t8_gloidx_t})::Cvoid +function p4est_connectivity_new_disk2d() + @ccall libt8.p4est_connectivity_new_disk2d()::Ptr{p4est_connectivity_t} end """ - t8_mesh_set_face(mesh, locid1, face1, locid2, face2, orientation) + p4est_connectivity_new_bowtie() -### Prototype -```c -void t8_mesh_set_face (t8_mesh_t *mesh, t8_locidx_t locid1, int face1, t8_locidx_t locid2, int face2, int orientation); -``` -""" -function t8_mesh_set_face(mesh, locid1, face1, locid2, face2, orientation) - @ccall libt8.t8_mesh_set_face(mesh::Ptr{t8_mesh_t}, locid1::t8_locidx_t, face1::Cint, locid2::t8_locidx_t, face2::Cint, orientation::Cint)::Cvoid -end +Create a connectivity structure that maps a 2d bowtie structure. -""" - t8_mesh_set_element_vertices(mesh, locid, vids_length, vids) +The 2 trees are connected by a corner connection at node A3 (0, 0). the nodes are given as: + +A00 A01 / \\ / \\ A02 A03 A04 \\ / \\ / A05 A06 ### Prototype ```c -void t8_mesh_set_element_vertices (t8_mesh_t *mesh, t8_locidx_t locid, t8_locidx_t vids_length, const t8_locidx_t *vids); +p4est_connectivity_t *p4est_connectivity_new_bowtie (void); ``` """ -function t8_mesh_set_element_vertices(mesh, locid, vids_length, vids) - @ccall libt8.t8_mesh_set_element_vertices(mesh::Ptr{t8_mesh_t}, locid::t8_locidx_t, vids_length::t8_locidx_t, vids::Ptr{t8_locidx_t})::Cvoid +function p4est_connectivity_new_bowtie() + @ccall libt8.p4est_connectivity_new_bowtie()::Ptr{p4est_connectivity_t} end """ - t8_mesh_build(mesh) + p4est_connectivity_new_brick(mi, ni, periodic_a, periodic_b) -Setup a mesh and turn it into a usable object. +A rectangular m by n array of trees with configurable periodicity. The brick is periodic in x and y if periodic\\_a and periodic\\_b are true, respectively. ### Prototype ```c -void t8_mesh_build (t8_mesh_t *mesh); +p4est_connectivity_t *p4est_connectivity_new_brick (int mi, int ni, int periodic_a, int periodic_b); ``` """ -function t8_mesh_build(mesh) - @ccall libt8.t8_mesh_build(mesh::Ptr{t8_mesh_t})::Cvoid +function p4est_connectivity_new_brick(mi, ni, periodic_a, periodic_b) + @ccall libt8.p4est_connectivity_new_brick(mi::Cint, ni::Cint, periodic_a::Cint, periodic_b::Cint)::Ptr{p4est_connectivity_t} end """ - t8_mesh_get_comm(mesh) - -### Prototype -```c -sc_MPI_Comm t8_mesh_get_comm (t8_mesh_t *mesh); -``` -""" -function t8_mesh_get_comm(mesh) - @ccall libt8.t8_mesh_get_comm(mesh::Ptr{t8_mesh_t})::Cint -end + p4est_connectivity_new_byname(name) -""" - t8_mesh_get_element_count(mesh, theclass) +Create connectivity structure from predefined catalogue. +# Arguments +* `name`:\\[in\\] Invokes connectivity\\_new\\_* function. brick23 brick (2, 3, 0, 0) corner corner cubed cubed disk disk moebius moebius periodic periodic pillow pillow rotwrap rotwrap star star unit unitsquare +# Returns +An initialized connectivity if name is defined, NULL else. ### Prototype ```c -t8_locidx_t t8_mesh_get_element_count (t8_mesh_t *mesh, t8_eclass_t theclass); +p4est_connectivity_t *p4est_connectivity_new_byname (const char *name); ``` """ -function t8_mesh_get_element_count(mesh, theclass) - @ccall libt8.t8_mesh_get_element_count(mesh::Ptr{t8_mesh_t}, theclass::t8_eclass_t)::t8_locidx_t +function p4est_connectivity_new_byname(name) + @ccall libt8.p4est_connectivity_new_byname(name::Cstring)::Ptr{p4est_connectivity_t} end """ - t8_mesh_get_element_class(mesh, locid) + p4est_connectivity_refine(conn, num_per_dim) + +Uniformly refine a connectivity. This is useful if you would like to uniformly refine by something other than a power of 2. # Arguments -* `locid`:\\[in\\] The local number can specify a point of any dimension that is locally relevant. The points are ordered in reverse to the element classes in t8_eclass_t. The local index is cumulative in this order. +* `conn`:\\[in\\] A valid connectivity +* `num_per_dim`:\\[in\\] The number of new trees in each direction. Must use no more than P4EST_OLD_QMAXLEVEL bits. +# Returns +a refined connectivity. ### Prototype ```c -t8_locidx_t t8_mesh_get_element_class (t8_mesh_t *mesh, t8_locidx_t locid); +p4est_connectivity_t *p4est_connectivity_refine (p4est_connectivity_t * conn, int num_per_dim); ``` """ -function t8_mesh_get_element_class(mesh, locid) - @ccall libt8.t8_mesh_get_element_class(mesh::Ptr{t8_mesh_t}, locid::t8_locidx_t)::t8_locidx_t +function p4est_connectivity_refine(conn, num_per_dim) + @ccall libt8.p4est_connectivity_refine(conn::Ptr{p4est_connectivity_t}, num_per_dim::Cint)::Ptr{p4est_connectivity_t} end """ - t8_mesh_get_element_locid(mesh, gloid) - -### Prototype -```c -t8_locidx_t t8_mesh_get_element_locid (t8_mesh_t *mesh, t8_gloidx_t gloid); -``` -""" -function t8_mesh_get_element_locid(mesh, gloid) - @ccall libt8.t8_mesh_get_element_locid(mesh::Ptr{t8_mesh_t}, gloid::t8_gloidx_t)::t8_locidx_t -end + p4est_expand_face_transform(iface, nface, ftransform) -""" - t8_mesh_get_element_gloid(mesh, locid) +Fill an array with the axis combination of a face neighbor transform. +# Arguments +* `iface`:\\[in\\] The number of the originating face. +* `nface`:\\[in\\] Encoded as nface = r * 4 + nf, where nf = 0..3 is the neigbbor's connecting face number and r = 0..1 is the relative orientation to the neighbor's face. This encoding matches [`p4est_connectivity_t`](@ref). +* `ftransform`:\\[out\\] This array holds 9 integers. [0,2] The coordinate axis sequence of the origin face, the first referring to the tangential and the second to the normal. A permutation of (0, 1). [3,5] The coordinate axis sequence of the target face. [6,8] Face reversal flag for tangential axis (boolean); face code in [0, 3] for the normal coordinate q: 0: q' = -q 1: q' = q + 1 2: q' = q - 1 3: q' = 2 - q [1,4,7] 0 (unused for compatibility with 3D). ### Prototype ```c -t8_gloidx_t t8_mesh_get_element_gloid (t8_mesh_t *mesh, t8_locidx_t locid); +void p4est_expand_face_transform (int iface, int nface, int ftransform[]); ``` """ -function t8_mesh_get_element_gloid(mesh, locid) - @ccall libt8.t8_mesh_get_element_gloid(mesh::Ptr{t8_mesh_t}, locid::t8_locidx_t)::t8_gloidx_t +function p4est_expand_face_transform(iface, nface, ftransform) + @ccall libt8.p4est_expand_face_transform(iface::Cint, nface::Cint, ftransform::Ptr{Cint})::Cvoid end """ - t8_mesh_get_element(mesh, locid) + p4est_find_face_transform(connectivity, itree, iface, ftransform) -### Prototype -```c -t8_element_t t8_mesh_get_element (t8_mesh_t *mesh, t8_locidx_t locid); -``` -""" -function t8_mesh_get_element(mesh, locid) - @ccall libt8.t8_mesh_get_element(mesh::Ptr{t8_mesh_t}, locid::t8_locidx_t)::t8_element_t -end +Fill an array with the axis combinations of a tree neighbor transform. -""" - t8_mesh_get_element_boundary(mesh, locid, length_boundary, elemid, orientation) +# Arguments +* `connectivity`:\\[in\\] Connectivity structure. +* `itree`:\\[in\\] The number of the originating tree. +* `iface`:\\[in\\] The number of the originating tree's face. +* `ftransform`:\\[out\\] This array holds 9 integers. [0,2] The coordinate axis sequence of the origin face. [3,5] The coordinate axis sequence of the target face. [6,8] Face reversal flag for axis t; face code for axis n. +# Returns +The face neighbor tree if it exists, -1 otherwise. +# See also +[`p4est_expand_face_transform`](@ref). [1,4,7] 0 (unused for compatibility with 3D). ### Prototype ```c -void t8_mesh_get_element_boundary (t8_mesh_t *mesh, t8_locidx_t locid, int length_boundary, t8_locidx_t *elemid, int *orientation); +p4est_topidx_t p4est_find_face_transform (p4est_connectivity_t * connectivity, p4est_topidx_t itree, int iface, int ftransform[]); ``` """ -function t8_mesh_get_element_boundary(mesh, locid, length_boundary, elemid, orientation) - @ccall libt8.t8_mesh_get_element_boundary(mesh::Ptr{t8_mesh_t}, locid::t8_locidx_t, length_boundary::Cint, elemid::Ptr{t8_locidx_t}, orientation::Ptr{Cint})::Cvoid +function p4est_find_face_transform(connectivity, itree, iface, ftransform) + @ccall libt8.p4est_find_face_transform(connectivity::Ptr{p4est_connectivity_t}, itree::p4est_topidx_t, iface::Cint, ftransform::Ptr{Cint})::p4est_topidx_t end """ - t8_mesh_get_maximum_support(mesh) - -Return the maximum of the length of the support of any local element. - -### Prototype -```c -int t8_mesh_get_maximum_support (t8_mesh_t *mesh); -``` -""" -function t8_mesh_get_maximum_support(mesh) - @ccall libt8.t8_mesh_get_maximum_support(mesh::Ptr{t8_mesh_t})::Cint -end + p4est_find_corner_transform(connectivity, itree, icorner, ci) -""" - t8_mesh_get_element_support(mesh, locid, length_support, elemid, orientation) +Fills an array with information about corner neighbors. # Arguments -* `length_support`:\\[in,out\\] +* `connectivity`:\\[in\\] Connectivity structure. +* `itree`:\\[in\\] The number of the originating tree. +* `icorner`:\\[in\\] The number of the originating corner. +* `ci`:\\[in,out\\] A [`p4est_corner_info_t`](@ref) structure with initialized array. ### Prototype ```c -void t8_mesh_get_element_support (t8_mesh_t *mesh, t8_locidx_t locid, int *length_support, t8_locidx_t *elemid, int *orientation); +void p4est_find_corner_transform (p4est_connectivity_t * connectivity, p4est_topidx_t itree, int icorner, p4est_corner_info_t * ci); ``` """ -function t8_mesh_get_element_support(mesh, locid, length_support, elemid, orientation) - @ccall libt8.t8_mesh_get_element_support(mesh::Ptr{t8_mesh_t}, locid::t8_locidx_t, length_support::Ptr{Cint}, elemid::Ptr{t8_locidx_t}, orientation::Ptr{Cint})::Cvoid +function p4est_find_corner_transform(connectivity, itree, icorner, ci) + @ccall libt8.p4est_find_corner_transform(connectivity::Ptr{p4est_connectivity_t}, itree::p4est_topidx_t, icorner::Cint, ci::Ptr{p4est_corner_info_t})::Cvoid end """ - t8_mesh_destroy(mesh) + p4est_connectivity_complete(conn) -*************************** destruct ************************ +Internally connect a connectivity based on tree\\_to\\_vertex information. Periodicity that is not inherent in the list of vertices will be lost. +# Arguments +* `conn`:\\[in,out\\] The connectivity needs to have proper vertices and tree\\_to\\_vertex fields. The tree\\_to\\_tree and tree\\_to\\_face fields must be allocated and satisfy [`p4est_connectivity_is_valid`](@ref) (conn) but will be overwritten. The corner fields will be freed and allocated anew. ### Prototype ```c -void t8_mesh_destroy (t8_mesh_t *mesh); +void p4est_connectivity_complete (p4est_connectivity_t * conn); ``` """ -function t8_mesh_destroy(mesh) - @ccall libt8.t8_mesh_destroy(mesh::Ptr{t8_mesh_t})::Cvoid +function p4est_connectivity_complete(conn) + @ccall libt8.p4est_connectivity_complete(conn::Ptr{p4est_connectivity_t})::Cvoid end -const t8_nc_int64_t = Int64 - -const t8_nc_int32_t = Int32 - """ - t8_netcdf_create_var(var_type, var_name, var_long_name, var_unit, var_data) + p4est_connectivity_reduce(conn) -Create an extern double variable which additionally should be put out to the NetCDF File +Removes corner information of a connectivity such that enough information is left to run [`p4est_connectivity_complete`](@ref) successfully. The reduced connectivity still passes [`p4est_connectivity_is_valid`](@ref). # Arguments -* `var_type`:\\[in\\] Defines the datatype of the variable, either T8\\_NETCDF\\_INT, T8\\_NETCDF\\_INT64 or T8\\_NETCDF\\_DOUBLE. -* `var_name`:\\[in\\] A String which will be the name of the created variable. -* `var_long_name`:\\[in\\] A string describing the variable a bit more and what it is about. -* `var_unit`:\\[in\\] The units in which the data is provided. -* `var_data`:\\[in\\] A [`sc_array_t`](@ref) holding the elementwise data of the variable. -* `num_extern_netcdf_vars`:\\[in\\] The number of extern user-defined variables which hold elementwise data (if none, set it to 0). +* `conn`:\\[in,out\\] The connectivity to be reduced. ### Prototype ```c -t8_netcdf_variable_t * t8_netcdf_create_var (t8_netcdf_variable_type_t var_type, const char *var_name, const char *var_long_name, const char *var_unit, sc_array_t *var_data); +void p4est_connectivity_reduce (p4est_connectivity_t * conn); ``` """ -function t8_netcdf_create_var(var_type, var_name, var_long_name, var_unit, var_data) - @ccall libt8.t8_netcdf_create_var(var_type::t8_netcdf_variable_type_t, var_name::Cstring, var_long_name::Cstring, var_unit::Cstring, var_data::Ptr{sc_array_t})::Ptr{t8_netcdf_variable_t} +function p4est_connectivity_reduce(conn) + @ccall libt8.p4est_connectivity_reduce(conn::Ptr{p4est_connectivity_t})::Cvoid end """ - t8_netcdf_create_integer_var(var_name, var_long_name, var_unit, var_data) + p4est_connectivity_permute(conn, perm, is_current_to_new) -Create an extern integer variable which additionally should be put out to the NetCDF File (The distinction if it will be a NC\\_INT or NC\\_INT64 variable is based on the elementsize of the given [`sc_array_t`](@ref)) +[`p4est_connectivity_permute`](@ref) Given a permutation *perm* of the trees in a connectivity *conn*, permute the trees of *conn* in place and update *conn* to match. # Arguments -* `var_name`:\\[in\\] A String which will be the name of the created variable. -* `var_long_name`:\\[in\\] A string describing the variable a bit more and what it is about. -* `var_unit`:\\[in\\] The units in which the data is provided. -* `var_data`:\\[in\\] A [`sc_array_t`](@ref) holding the elementwise data of the variable. -* `num_extern_netcdf_vars`:\\[in\\] The number of extern user-defined variables which hold elementwise data (if none, set it to 0). +* `conn`:\\[in,out\\] The connectivity whose trees are permuted. +* `perm`:\\[in\\] A permutation array, whose elements are size\\_t's. +* `is_current_to_new`:\\[in\\] if true, the jth entry of perm is the new index for the entry whose current index is j, otherwise the jth entry of perm is the current index of the tree whose index will be j after the permutation. ### Prototype ```c -t8_netcdf_variable_t * t8_netcdf_create_integer_var (const char *var_name, const char *var_long_name, const char *var_unit, sc_array_t *var_data); +void p4est_connectivity_permute (p4est_connectivity_t * conn, sc_array_t * perm, int is_current_to_new); ``` """ -function t8_netcdf_create_integer_var(var_name, var_long_name, var_unit, var_data) - @ccall libt8.t8_netcdf_create_integer_var(var_name::Cstring, var_long_name::Cstring, var_unit::Cstring, var_data::Ptr{sc_array_t})::Ptr{t8_netcdf_variable_t} +function p4est_connectivity_permute(conn, perm, is_current_to_new) + @ccall libt8.p4est_connectivity_permute(conn::Ptr{p4est_connectivity_t}, perm::Ptr{sc_array_t}, is_current_to_new::Cint)::Cvoid end """ - t8_netcdf_create_double_var(var_name, var_long_name, var_unit, var_data) + p4est_connectivity_join_faces(conn, tree_left, tree_right, face_left, face_right, orientation) -Create an extern double variable which additionally should be put out to the NetCDF File +[`p4est_connectivity_join_faces`](@ref) This function takes an existing valid connectivity *conn* and modifies it by joining two tree faces that are currently boundary faces. # Arguments -* `var_name`:\\[in\\] A String which will be the name of the created variable. -* `var_long_name`:\\[in\\] A string describing the variable a bit more and what it is about. -* `var_unit`:\\[in\\] The units in which the data is provided. -* `var_data`:\\[in\\] A [`sc_array_t`](@ref) holding the elementwise data of the variable. -* `num_extern_netcdf_vars`:\\[in\\] The number of extern user-defined variables which hold elementwise data (if none, set it to 0). +* `conn`:\\[in,out\\] connectivity that will be altered. +* `tree_left`:\\[in\\] tree that will be on the left side of the joined faces. +* `tree_right`:\\[in\\] tree that will be on the right side of the joined faces. +* `face_left`:\\[in\\] face of *tree_left* that will be joined. +* `face_right`:\\[in\\] face of *tree_right* that will be joined. +* `orientation`:\\[in\\] the orientation of *face_left* and *face_right* once joined (see the description of [`p4est_connectivity_t`](@ref) to understand orientation). ### Prototype ```c -t8_netcdf_variable_t * t8_netcdf_create_double_var (const char *var_name, const char *var_long_name, const char *var_unit, sc_array_t *var_data); +void p4est_connectivity_join_faces (p4est_connectivity_t * conn, p4est_topidx_t tree_left, p4est_topidx_t tree_right, int face_left, int face_right, int orientation); ``` """ -function t8_netcdf_create_double_var(var_name, var_long_name, var_unit, var_data) - @ccall libt8.t8_netcdf_create_double_var(var_name::Cstring, var_long_name::Cstring, var_unit::Cstring, var_data::Ptr{sc_array_t})::Ptr{t8_netcdf_variable_t} +function p4est_connectivity_join_faces(conn, tree_left, tree_right, face_left, face_right, orientation) + @ccall libt8.p4est_connectivity_join_faces(conn::Ptr{p4est_connectivity_t}, tree_left::p4est_topidx_t, tree_right::p4est_topidx_t, face_left::Cint, face_right::Cint, orientation::Cint)::Cvoid end """ - t8_netcdf_variable_destroy(var_destroy) + p4est_connectivity_is_equivalent(conn1, conn2) -Free the allocated memory of the a [`t8_netcdf_variable_t`](@ref) +[`p4est_connectivity_is_equivalent`](@ref) This function compares two connectivities for equivalence: it returns *true* if they are the same connectivity, or if they have the same topology. The definition of topological sameness is strict: there is no attempt made to determine whether permutation and/or rotation of the trees makes the connectivities equivalent. # Arguments -* `var_destroy`:\\[in\\] A t8\\_netcdf\\_t variable whose allocated memory should be freed. +* `conn1`:\\[in\\] a valid connectivity +* `conn2`:\\[out\\] a valid connectivity ### Prototype ```c -void t8_netcdf_variable_destroy (t8_netcdf_variable_t *var_destroy); +int p4est_connectivity_is_equivalent (p4est_connectivity_t * conn1, p4est_connectivity_t * conn2); ``` """ -function t8_netcdf_variable_destroy(var_destroy) - @ccall libt8.t8_netcdf_variable_destroy(var_destroy::Ptr{t8_netcdf_variable_t})::Cvoid +function p4est_connectivity_is_equivalent(conn1, conn2) + @ccall libt8.p4est_connectivity_is_equivalent(conn1::Ptr{p4est_connectivity_t}, conn2::Ptr{p4est_connectivity_t})::Cint end """ - t8_refcount_init(rc) - -Initialize a reference counter to 1. It is legal if its status prior to this call is undefined. + p4est_corner_array_index(array, it) -# Arguments -* `rc`:\\[out\\] The reference counter is set to one by this call. ### Prototype ```c -void t8_refcount_init (t8_refcount_t *rc); +static inline p4est_corner_transform_t * p4est_corner_array_index (sc_array_t * array, size_t it); ``` """ -function t8_refcount_init(rc) - @ccall libt8.t8_refcount_init(rc::Ptr{t8_refcount_t})::Cvoid +function p4est_corner_array_index(array, it) + @ccall libt8.p4est_corner_array_index(array::Ptr{sc_array_t}, it::Csize_t)::Ptr{p4est_corner_transform_t} end """ - t8_refcount_new() + p4est_connectivity_read_inp_stream(stream, num_vertices, num_trees, vertices, tree_to_vertex) -Create a new reference counter with count initialized to 1. Equivalent to calling [`t8_refcount_init`](@ref) on a newly allocated refcount\\_t. It is mandatory to free this with t8_refcount_destroy. +Read an ABAQUS input file from a file stream. -# Returns -An allocated reference counter whose count has been set to one. -### Prototype -```c -t8_refcount_t * t8_refcount_new (void); -``` -""" -function t8_refcount_new() - @ccall libt8.t8_refcount_new()::Ptr{t8_refcount_t} -end +This utility function reads a basic ABAQUS file supporting element type with the prefix C2D4, CPS4, and S4 in 2D and of type C3D8 reading them as bilinear quadrilateral and trilinear hexahedral trees respectively. -""" - t8_refcount_destroy(rc) +A basic 2D mesh is given below. The `*Node` section gives the vertex number and x, y, and z components for each vertex. The `*Element` section gives the 4 vertices in 2D (8 vertices in 3D) of each element in counter clockwise order. So in 2D the nodes are given as: -Destroy a reference counter that we allocated with t8_refcount_new. Its reference count must have decreased to zero. +4 3 +-------------------+ | | | | | | | | | | | | +-------------------+ 1 2 -# Arguments -* `rc`:\\[in,out\\] Allocated, formerly valid reference counter. -### Prototype -```c -void t8_refcount_destroy (t8_refcount_t *rc); -``` -""" -function t8_refcount_destroy(rc) - @ccall libt8.t8_refcount_destroy(rc::Ptr{t8_refcount_t})::Cvoid -end +and in 3D they are given as: -""" - t8_vec_norm(vec) +8 7 +---------------------+ |\\ |\\ | \\ | \\ | \\ | \\ | \\ | \\ | 5+---------------------+6 | | | | +----|----------------+ | 4\\ | 3 \\ | \\ | \\ | \\ | \\ | \\| \\| +---------------------+ 1 2 -Vector norm. +```c++ + *Heading + box.inp + *Node + 1, -5, -5, 0 + 2, 5, -5, 0 + 3, 5, 5, 0 + 4, -5, 5, 0 + 5, 0, -5, 0 + 6, 5, 0, 0 + 7, 0, 5, 0 + 8, -5, 0, 0 + 9, 1, -1, 0 + 10, 0, 0, 0 + 11, -2, 1, 0 + *Element, type=CPS4, ELSET=Surface1 + 1, 1, 10, 11, 8 + 2, 3, 10, 9, 6 + 3, 9, 10, 1, 5 + 4, 7, 4, 8, 11 + 5, 11, 10, 3, 7 + 6, 2, 6, 9, 5 +``` + +This code can be called two ways. The first, when `vertex`==NULL and `tree_to_vertex`==NULL, is used to count the number of trees and vertices in the connectivity to be generated by the `.inp` mesh in the *stream*. The second, when `vertices`!=NULL and `tree_to_vertex`!=NULL, fill `vertices` and `tree_to_vertex`. In this case `num_vertices` and `num_trees` need to be set to the maximum number of entries allocated in `vertices` and `tree_to_vertex`. # Arguments -* `vec`:\\[in\\] A 3D vector. +* `stream`:\\[in,out\\] file stream to read the connectivity from +* `num_vertices`:\\[in,out\\] the number of vertices in the connectivity +* `num_trees`:\\[in,out\\] the number of trees in the connectivity +* `vertices`:\\[out\\] the list of `vertices` of the connectivity +* `tree_to_vertex`:\\[out\\] the `tree_to_vertex` map of the connectivity # Returns -The norm of *vec*. +0 if successful and nonzero if not ### Prototype ```c -static inline double t8_vec_norm (const double vec[3]); +int p4est_connectivity_read_inp_stream (FILE * stream, p4est_topidx_t * num_vertices, p4est_topidx_t * num_trees, double *vertices, p4est_topidx_t * tree_to_vertex); ``` """ -function t8_vec_norm(vec) - @ccall libt8.t8_vec_norm(vec::Ptr{Cdouble})::Cdouble +function p4est_connectivity_read_inp_stream(stream, num_vertices, num_trees, vertices, tree_to_vertex) + @ccall libt8.p4est_connectivity_read_inp_stream(stream::Ptr{Libc.FILE}, num_vertices::Ptr{p4est_topidx_t}, num_trees::Ptr{p4est_topidx_t}, vertices::Ptr{Cdouble}, tree_to_vertex::Ptr{p4est_topidx_t})::Cint end """ - t8_vec_normalize(vec) + p4est_connectivity_read_inp(filename) -Normalize a vector. +Create a p4est connectivity from an ABAQUS input file. + +This utility function reads a basic ABAQUS file supporting element type with the prefix C2D4, CPS4, and S4 in 2D and of type C3D8 reading them as bilinear quadrilateral and trilinear hexahedral trees respectively. + +A basic 2D mesh is given below. The `*Node` section gives the vertex number and x, y, and z components for each vertex. The `*Element` section gives the 4 vertices in 2D (8 vertices in 3D) of each element in counter clockwise order. So in 2D the nodes are given as: + +4 3 +-------------------+ | | | | | | | | | | | | +-------------------+ 1 2 + +and in 3D they are given as: + +8 7 +---------------------+ |\\ |\\ | \\ | \\ | \\ | \\ | \\ | \\ | 5+---------------------+6 | | | | +----|----------------+ | 4\\ | 3 \\ | \\ | \\ | \\ | \\ | \\| \\| +---------------------+ 1 2 + +```c++ + *Heading + box.inp + *Node + 1, -5, -5, 0 + 2, 5, -5, 0 + 3, 5, 5, 0 + 4, -5, 5, 0 + 5, 0, -5, 0 + 6, 5, 0, 0 + 7, 0, 5, 0 + 8, -5, 0, 0 + 9, 1, -1, 0 + 10, 0, 0, 0 + 11, -2, 1, 0 + *Element, type=CPS4, ELSET=Surface1 + 1, 1, 10, 11, 8 + 2, 3, 10, 9, 6 + 3, 9, 10, 1, 5 + 4, 7, 4, 8, 11 + 5, 11, 10, 3, 7 + 6, 2, 6, 9, 5 +``` + +This function reads a mesh from *filename* and returns an associated p4est connectivity. # Arguments -* `vec`:\\[in,out\\] A 3D vector. +* `filename`:\\[in\\] file to read the connectivity from +# Returns +an allocated connectivity associated with the mesh in *filename* or NULL if an error occurred. ### Prototype ```c -static inline void t8_vec_normalize (double vec[3]); +p4est_connectivity_t *p4est_connectivity_read_inp (const char *filename); ``` """ -function t8_vec_normalize(vec) - @ccall libt8.t8_vec_normalize(vec::Ptr{Cdouble})::Cvoid +function p4est_connectivity_read_inp(filename) + @ccall libt8.p4est_connectivity_read_inp(filename::Cstring)::Ptr{p4est_connectivity_t} end """ - t8_vec_copy(vec_in, vec_out) + p8est_connect_type_t -Make a copy of a vector. +Characterize a type of adjacency. -# Arguments -* `vec_in`:\\[in\\] -* `vec_out`:\\[out\\] -### Prototype -```c -static inline void t8_vec_copy (const double vec_in[3], double vec_out[3]); -``` +Several functions involve relationships between neighboring trees and/or quadrants, and their behavior depends on how one defines adjacency: 1) entities are adjacent if they share a face, or 2) entities are adjacent if they share a face or corner, or 3) entities are adjacent if they share a face, corner or edge. [`p8est_connect_type_t`](@ref) is used to choose the desired behavior. This enum must fit into an int8\\_t. + +| Enumerator | Note | +| :----------------------- | :------------------------------- | +| P8EST\\_CONNECT\\_SELF | No balance whatsoever. | +| P8EST\\_CONNECT\\_FACE | Balance across faces only. | +| P8EST\\_CONNECT\\_EDGE | Balance across faces and edges. | +| P8EST\\_CONNECT\\_ALMOST | = CORNER - 1. | +| P8EST\\_CONNECT\\_CORNER | Balance faces, edges, corners. | +| P8EST\\_CONNECT\\_FULL | = CORNER. | """ -function t8_vec_copy(vec_in, vec_out) - @ccall libt8.t8_vec_copy(vec_in::Ptr{Cdouble}, vec_out::Ptr{Cdouble})::Cvoid +@cenum p8est_connect_type_t::UInt32 begin + P8EST_CONNECT_SELF = 30 + P8EST_CONNECT_FACE = 31 + P8EST_CONNECT_EDGE = 32 + P8EST_CONNECT_ALMOST = 32 + P8EST_CONNECT_CORNER = 33 + P8EST_CONNECT_FULL = 33 end """ - t8_vec_dist(vec_x, vec_y) + p8est_connectivity_encode_t -Euclidean distance of X and Y. +Typedef for serialization method. -# Arguments -* `vec_x`:\\[in\\] A 3D vector. -* `vec_y`:\\[in\\] A 3D vector. -# Returns -The euclidean distance. Equivalent to norm (X-Y). -### Prototype -```c -static inline double t8_vec_dist (const double vec_x[3], const double vec_y[3]); -``` +| Enumerator | Note | +| :--------------------------- | :-------------------------------- | +| P8EST\\_CONN\\_ENCODE\\_LAST | Invalid entry to close the list. | """ -function t8_vec_dist(vec_x, vec_y) - @ccall libt8.t8_vec_dist(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble})::Cdouble +@cenum p8est_connectivity_encode_t::UInt32 begin + P8EST_CONN_ENCODE_NONE = 0 + P8EST_CONN_ENCODE_LAST = 1 end """ - t8_vec_ax(vec_x, alpha) + p8est_connect_type_int(btype) -Compute X = alpha * X +Convert the [`p8est_connect_type_t`](@ref) into a number. # Arguments -* `vec_x`:\\[in,out\\] A 3D vector. On output set to *alpha* * *vec_x*. -* `alpha`:\\[in\\] A factor. +* `btype`:\\[in\\] The balance type to convert. +# Returns +Returns 1, 2 or 3. ### Prototype ```c -static inline void t8_vec_ax (double vec_x[3], const double alpha); +int p8est_connect_type_int (p8est_connect_type_t btype); ``` """ -function t8_vec_ax(vec_x, alpha) - @ccall libt8.t8_vec_ax(vec_x::Ptr{Cdouble}, alpha::Cdouble)::Cvoid +function p8est_connect_type_int(btype) + @ccall libt8.p8est_connect_type_int(btype::p8est_connect_type_t)::Cint end """ - t8_vec_axy(vec_x, vec_y, alpha) + p8est_connect_type_string(btype) -Compute Y = alpha * X +Convert the [`p8est_connect_type_t`](@ref) into a const string. # Arguments -* `vec_x`:\\[in\\] A 3D vector. -* `vec_z`:\\[out\\] On output set to *alpha* * *vec_x*. -* `alpha`:\\[in\\] A factor. +* `btype`:\\[in\\] The balance type to convert. +# Returns +Returns a pointer to a constant string. ### Prototype ```c -static inline void t8_vec_axy (const double vec_x[3], double vec_y[3], const double alpha); +const char *p8est_connect_type_string (p8est_connect_type_t btype); ``` """ -function t8_vec_axy(vec_x, vec_y, alpha) - @ccall libt8.t8_vec_axy(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, alpha::Cdouble)::Cvoid +function p8est_connect_type_string(btype) + @ccall libt8.p8est_connect_type_string(btype::p8est_connect_type_t)::Cstring end """ - t8_vec_axb(vec_x, vec_y, alpha, b) + p8est_connectivity -Y = alpha * X + b +This structure holds the 3D inter-tree connectivity information. Identification of arbitrary faces, edges and corners is possible. -!!! note +The arrays tree\\_to\\_* are stored in z ordering. For corners the order wrt. zyx is 000 001 010 011 100 101 110 111. For faces the order is -x +x -y +y -z +z. They are allocated [0][0]..[0][N-1]..[num\\_trees-1][0]..[num\\_trees-1][N-1]. where N is 6 for tree and face, 8 for corner, 12 for edge. If a face is on the physical boundary it must connect to itself. - It is possible that vec\\_x = vec\\_y on input to overwrite x +The values for tree\\_to\\_face are in 0..23 where ttf % 6 gives the face number and ttf / 6 the face orientation code. The orientation is determined as follows. Let my\\_face and other\\_face be the two face numbers of the connecting trees in 0..5. Then the first face corner of the lower of my\\_face and other\\_face connects to a face corner numbered 0..3 in the higher of my\\_face and other\\_face. The face orientation is defined as this number. If my\\_face == other\\_face, treating either of both faces as the lower one leads to the same result. -# Arguments -* `vec_x`:\\[in\\] A 3D vector. -* `vec_y`:\\[out\\] On input, a 3D vector. On output set to *alpha* * *vec_x* + *b*. -* `alpha`:\\[in\\] A factor. -* `b`:\\[in\\] An offset. -### Prototype -```c -static inline void t8_vec_axb (const double vec_x[3], double vec_y[3], const double alpha, const double b); -``` -""" -function t8_vec_axb(vec_x, vec_y, alpha, b) - @ccall libt8.t8_vec_axb(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, alpha::Cdouble, b::Cdouble)::Cvoid -end +It is valid to specify num\\_vertices as 0. In this case vertices and tree\\_to\\_vertex are set to NULL. Otherwise the vertex coordinates are stored in the array vertices as [0][0]..[0][2]..[num\\_vertices-1][0]..[num\\_vertices-1][2]. Vertex coordinates are optional and not used for inferring topology. -""" - t8_vec_axpy(vec_x, vec_y, alpha) +The edges are stored when they connect trees that are not already face neighbors at that specific edge. In this case tree\\_to\\_edge indexes into *ett_offset*. Otherwise the tree\\_to\\_edge entry must be -1 and this edge is ignored. If num\\_edges == 0, tree\\_to\\_edge and edge\\_to\\_* arrays are set to NULL. -Y = Y + alpha * X +The arrays edge\\_to\\_* store a variable number of entries per edge. For edge e these are at position [ett\\_offset[e]]..[ett\\_offset[e+1]-1]. Their number for edge e is ett\\_offset[e+1] - ett\\_offset[e]. The entries encode all trees adjacent to edge e. The size of the edge\\_to\\_* arrays is num\\_ett = ett\\_offset[num\\_edges]. The edge\\_to\\_edge array holds values in 0..23, where the lower 12 indicate one edge orientation and the higher 12 the opposite edge orientation. -# Arguments -* `vec_x`:\\[in\\] A 3D vector. -* `vec_y`:\\[in,out\\] On input, a 3D vector. On output set *to* vec\\_y + *alpha* * *vec_x* -* `alpha`:\\[in\\] A factor. -### Prototype -```c -static inline void t8_vec_axpy (const double vec_x[3], double vec_y[3], const double alpha); -``` -""" -function t8_vec_axpy(vec_x, vec_y, alpha) - @ccall libt8.t8_vec_axpy(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, alpha::Cdouble)::Cvoid -end +The corners are stored when they connect trees that are not already edge or face neighbors at that specific corner. In this case tree\\_to\\_corner indexes into *ctt_offset*. Otherwise the tree\\_to\\_corner entry must be -1 and this corner is ignored. If num\\_corners == 0, tree\\_to\\_corner and corner\\_to\\_* arrays are set to NULL. -""" - t8_vec_axpyz(vec_x, vec_y, vec_z, alpha) +The arrays corner\\_to\\_* store a variable number of entries per corner. For corner c these are at position [ctt\\_offset[c]]..[ctt\\_offset[c+1]-1]. Their number for corner c is ctt\\_offset[c+1] - ctt\\_offset[c]. The entries encode all trees adjacent to corner c. The size of the corner\\_to\\_* arrays is num\\_ctt = ctt\\_offset[num\\_corners]. -Z = Y + alpha * X +The *\\_to\\_attr arrays may have arbitrary contents defined by the user. -# Arguments -* `vec_x`:\\[in\\] A 3D vector. -* `vec_y`:\\[in\\] A 3D vector. -* `vec_z`:\\[out\\] On output set *to* vec\\_y + *alpha* * *vec_x* -### Prototype -```c -static inline void t8_vec_axpyz (const double vec_x[3], const double vec_y[3], double vec_z[3], const double alpha); -``` +!!! note + + If a connectivity implies natural connections between trees that are edge neighbors without being face neighbors, these edges shall be encoded explicitly in the connectivity. If a connectivity implies natural connections between trees that are corner neighbors without being edge or face neighbors, these corners shall be encoded explicitly in the connectivity. + +| Field | Note | +| :------------------- | :----------------------------------------------------------------------------------- | +| num\\_vertices | the number of vertices that define the *embedding* of the forest (not the topology) | +| num\\_trees | the number of trees | +| num\\_edges | the number of edges that help define the topology | +| num\\_corners | the number of corners that help define the topology | +| vertices | an array of size (3 * *num_vertices*) | +| tree\\_to\\_vertex | embed each tree into ```c++ R^3 ``` for e.g. visualization (see p8est\\_vtk.h) | +| tree\\_attr\\_bytes | bytes per tree in tree\\_to\\_attr | +| tree\\_to\\_attr | not touched by p4est | +| tree\\_to\\_tree | (6 * *num_trees*) neighbors across faces | +| tree\\_to\\_face | (6 * *num_trees*) face to face+orientation (see description) | +| tree\\_to\\_edge | (12 * *num_trees*) or NULL (see description) | +| ett\\_offset | edge to offset in *edge_to_tree* and *edge_to_edge* | +| edge\\_to\\_tree | list of trees that meet at an edge | +| edge\\_to\\_edge | list of tree-edges+orientations that meet at an edge (see description) | +| tree\\_to\\_corner | (8 * *num_trees*) or NULL (see description) | +| ctt\\_offset | corner to offset in *corner_to_tree* and *corner_to_corner* | +| corner\\_to\\_tree | list of trees that meet at a corner | +| corner\\_to\\_corner | list of tree-corners that meet at a corner | """ -function t8_vec_axpyz(vec_x, vec_y, vec_z, alpha) - @ccall libt8.t8_vec_axpyz(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, vec_z::Ptr{Cdouble}, alpha::Cdouble)::Cvoid +struct p8est_connectivity + num_vertices::p4est_topidx_t + num_trees::p4est_topidx_t + num_edges::p4est_topidx_t + num_corners::p4est_topidx_t + vertices::Ptr{Cdouble} + tree_to_vertex::Ptr{p4est_topidx_t} + tree_attr_bytes::Csize_t + tree_to_attr::Cstring + tree_to_tree::Ptr{p4est_topidx_t} + tree_to_face::Ptr{Int8} + tree_to_edge::Ptr{p4est_topidx_t} + ett_offset::Ptr{p4est_topidx_t} + edge_to_tree::Ptr{p4est_topidx_t} + edge_to_edge::Ptr{Int8} + tree_to_corner::Ptr{p4est_topidx_t} + ctt_offset::Ptr{p4est_topidx_t} + corner_to_tree::Ptr{p4est_topidx_t} + corner_to_corner::Ptr{Int8} end """ - t8_vec_dot(vec_x, vec_y) +This structure holds the 3D inter-tree connectivity information. Identification of arbitrary faces, edges and corners is possible. -Dot product of X and Y. +The arrays tree\\_to\\_* are stored in z ordering. For corners the order wrt. zyx is 000 001 010 011 100 101 110 111. For faces the order is -x +x -y +y -z +z. They are allocated [0][0]..[0][N-1]..[num\\_trees-1][0]..[num\\_trees-1][N-1]. where N is 6 for tree and face, 8 for corner, 12 for edge. If a face is on the physical boundary it must connect to itself. -# Arguments -* `vec_x`:\\[in\\] A 3D vector. -* `vec_y`:\\[in\\] A 3D vector. -# Returns -The dot product *vec_x* * *vec_y* -### Prototype -```c -static inline double t8_vec_dot (const double vec_x[3], const double vec_y[3]); -``` -""" -function t8_vec_dot(vec_x, vec_y) - @ccall libt8.t8_vec_dot(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble})::Cdouble -end +The values for tree\\_to\\_face are in 0..23 where ttf % 6 gives the face number and ttf / 6 the face orientation code. The orientation is determined as follows. Let my\\_face and other\\_face be the two face numbers of the connecting trees in 0..5. Then the first face corner of the lower of my\\_face and other\\_face connects to a face corner numbered 0..3 in the higher of my\\_face and other\\_face. The face orientation is defined as this number. If my\\_face == other\\_face, treating either of both faces as the lower one leads to the same result. -""" - t8_vec_cross(vec_x, vec_y, cross) +It is valid to specify num\\_vertices as 0. In this case vertices and tree\\_to\\_vertex are set to NULL. Otherwise the vertex coordinates are stored in the array vertices as [0][0]..[0][2]..[num\\_vertices-1][0]..[num\\_vertices-1][2]. Vertex coordinates are optional and not used for inferring topology. -Cross product of X and Y +The edges are stored when they connect trees that are not already face neighbors at that specific edge. In this case tree\\_to\\_edge indexes into *ett_offset*. Otherwise the tree\\_to\\_edge entry must be -1 and this edge is ignored. If num\\_edges == 0, tree\\_to\\_edge and edge\\_to\\_* arrays are set to NULL. -# Arguments -* `vec_x`:\\[in\\] A 3D vector. -* `vec_y`:\\[in\\] A 3D vector. -* `cross`:\\[out\\] On output, the cross product of *vec_x* and *vec_y*. -### Prototype -```c -static inline void t8_vec_cross (const double vec_x[3], const double vec_y[3], double cross[3]); -``` -""" -function t8_vec_cross(vec_x, vec_y, cross) - @ccall libt8.t8_vec_cross(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, cross::Ptr{Cdouble})::Cvoid -end +The arrays edge\\_to\\_* store a variable number of entries per edge. For edge e these are at position [ett\\_offset[e]]..[ett\\_offset[e+1]-1]. Their number for edge e is ett\\_offset[e+1] - ett\\_offset[e]. The entries encode all trees adjacent to edge e. The size of the edge\\_to\\_* arrays is num\\_ett = ett\\_offset[num\\_edges]. The edge\\_to\\_edge array holds values in 0..23, where the lower 12 indicate one edge orientation and the higher 12 the opposite edge orientation. -""" - t8_vec_diff(vec_x, vec_y, diff) +The corners are stored when they connect trees that are not already edge or face neighbors at that specific corner. In this case tree\\_to\\_corner indexes into *ctt_offset*. Otherwise the tree\\_to\\_corner entry must be -1 and this corner is ignored. If num\\_corners == 0, tree\\_to\\_corner and corner\\_to\\_* arrays are set to NULL. -Compute the difference of two vectors. +The arrays corner\\_to\\_* store a variable number of entries per corner. For corner c these are at position [ctt\\_offset[c]]..[ctt\\_offset[c+1]-1]. Their number for corner c is ctt\\_offset[c+1] - ctt\\_offset[c]. The entries encode all trees adjacent to corner c. The size of the corner\\_to\\_* arrays is num\\_ctt = ctt\\_offset[num\\_corners]. -# Arguments -* `vec_x`:\\[in\\] A 3D vector. -* `vec_y`:\\[in\\] A 3D vector. -* `diff`:\\[out\\] On output, the difference of *vec_x* and *vec_y*. -### Prototype -```c -static inline void t8_vec_diff (const double vec_x[3], const double vec_y[3], double diff[3]); -``` +The *\\_to\\_attr arrays may have arbitrary contents defined by the user. + +!!! note + + If a connectivity implies natural connections between trees that are edge neighbors without being face neighbors, these edges shall be encoded explicitly in the connectivity. If a connectivity implies natural connections between trees that are corner neighbors without being edge or face neighbors, these corners shall be encoded explicitly in the connectivity. """ -function t8_vec_diff(vec_x, vec_y, diff) - @ccall libt8.t8_vec_diff(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, diff::Ptr{Cdouble})::Cvoid -end +const p8est_connectivity_t = p8est_connectivity """ - t8_vec_eq(vec_x, vec_y, tol) + p8est_connectivity_memory_used(conn) -Check the equality of two vectors elementwise +Calculate memory usage of a connectivity structure. # Arguments -* `vec_x`:\\[in\\] -* `vec_y`:\\[in\\] -* `tol`:\\[in\\] +* `conn`:\\[in\\] Connectivity structure. # Returns -true, if the vectors are equal up to *tol* +Memory used in bytes. ### Prototype ```c -static inline int t8_vec_eq (const double vec_x[3], const double vec_y[3], const double tol); +size_t p8est_connectivity_memory_used (p8est_connectivity_t * conn); ``` """ -function t8_vec_eq(vec_x, vec_y, tol) - @ccall libt8.t8_vec_eq(vec_x::Ptr{Cdouble}, vec_y::Ptr{Cdouble}, tol::Cdouble)::Cint +function p8est_connectivity_memory_used(conn) + @ccall libt8.p8est_connectivity_memory_used(conn::Ptr{p8est_connectivity_t})::Csize_t end """ - t8_vec_rescale(vec, new_length) + p8est_edge_transform_t -Rescale a vector to a new length. +Generic interface for transformations between a tree and any of its edge -# Arguments -* `vec`:\\[in,out\\] A 3D vector. -* `new_length`:\\[in\\] New length of the vector. -### Prototype -```c -static inline void t8_vec_rescale (double vec[3], const double new_length); -``` -""" -function t8_vec_rescale(vec, new_length) - @ccall libt8.t8_vec_rescale(vec::Ptr{Cdouble}, new_length::Cdouble)::Cvoid -end - -""" - t8_vec_tri_normal(p1, p2, p3, normal) - -Compute the normal of a triangle given by its three vertices. - -# Arguments -* `p1`:\\[in\\] A 3D vector. -* `p2`:\\[in\\] A 3D vector. -* `p3`:\\[in\\] A 3D vector. -* `Normal`:\\[out\\] vector of the triangle. (Not necessarily of length 1!) -### Prototype -```c -static inline void t8_vec_tri_normal (const double p1[3], const double p2[3], const double p3[3], double normal[3]); -``` -""" -function t8_vec_tri_normal(p1, p2, p3, normal) - @ccall libt8.t8_vec_tri_normal(p1::Ptr{Cdouble}, p2::Ptr{Cdouble}, p3::Ptr{Cdouble}, normal::Ptr{Cdouble})::Cvoid -end - -""" - t8_vec_orthogonal_tripod(v1, v2, v3) - -Compute an orthogonal coordinate system from a given vector. - -# Arguments -* `v1`:\\[in\\] 3D vector. -* `v2`:\\[out\\] 3D vector. -* `v3`:\\[out\\] 3D vector. -### Prototype -```c -static inline void t8_vec_orthogonal_tripod (const double v1[3], double v2[3], double v3[3]); -``` -""" -function t8_vec_orthogonal_tripod(v1, v2, v3) - @ccall libt8.t8_vec_orthogonal_tripod(v1::Ptr{Cdouble}, v2::Ptr{Cdouble}, v3::Ptr{Cdouble})::Cvoid -end - -""" - t8_vec_swap(p1, p2) - -Swap the components of two vectors. - -# Arguments -* `p1`:\\[in,out\\] A 3D vector. -* `p2`:\\[in,out\\] A 3D vector. -### Prototype -```c -static inline void t8_vec_swap (double p1[3], double p2[3]); -``` -""" -function t8_vec_swap(p1, p2) - @ccall libt8.t8_vec_swap(p1::Ptr{Cdouble}, p2::Ptr{Cdouble})::Cvoid -end - -# no prototype is found for this function at t8_version.h:70:1, please use with caution -""" - t8_get_package_string() - -Return the package string of t8code. This string has the format "t8 version\\_number". - -# Returns -The version string of t8code. -### Prototype -```c -const char* t8_get_package_string (); -``` -""" -function t8_get_package_string() - @ccall libt8.t8_get_package_string()::Cstring -end - -# no prototype is found for this function at t8_version.h:76:1, please use with caution -""" - t8_get_version_number() - -Return the version number of t8code as a string. - -# Returns -The version number of t8code as a string. -### Prototype -```c -const char* t8_get_version_number (); -``` -""" -function t8_get_version_number() - @ccall libt8.t8_get_version_number()::Cstring -end - -# no prototype is found for this function at t8_version.h:82:1, please use with caution -""" - t8_get_version_point_string() - -Return the version point string. - -# Returns -The version point point string. -### Prototype -```c -const char* t8_get_version_point_string (); -``` -""" -function t8_get_version_point_string() - @ccall libt8.t8_get_version_point_string()::Cstring -end - -# no prototype is found for this function at t8_version.h:88:1, please use with caution -""" - t8_get_version_major() - -Return the major version number of t8code. - -# Returns -The major version number of t8code. -### Prototype -```c -int t8_get_version_major (); -``` -""" -function t8_get_version_major() - @ccall libt8.t8_get_version_major()::Cint -end - -# no prototype is found for this function at t8_version.h:94:1, please use with caution -""" - t8_get_version_minor() - -Return the minor version number of t8code. - -# Returns -The minor version number of t8code. -### Prototype -```c -int t8_get_version_minor (); -``` -""" -function t8_get_version_minor() - @ccall libt8.t8_get_version_minor()::Cint -end - -# no prototype is found for this function at t8_version.h:104:1, please use with caution -""" - t8_get_version_patch() - -Return the patch version number of t8code. - -!!! note - - -# Returns -The patch version number of t8code. negative on error. -### Prototype -```c -int t8_get_version_patch (); -``` -""" -function t8_get_version_patch() - @ccall libt8.t8_get_version_patch()::Cint -end - -@cenum t8_vtk_data_type_t::UInt32 begin - T8_VTK_SCALAR = 0 - T8_VTK_VECTOR = 1 -end - -""" - t8_vtk_data_field_t - -| Field | Note | -| :---------- | :----------------------------------------- | -| type | Describes of which type the data array is | -| description | String that describes the data. | -""" -struct t8_vtk_data_field_t - type::t8_vtk_data_type_t - description::NTuple{8192, Cchar} - data::Ptr{Cdouble} -end - -""" - t8_write_pvtu(filename, num_procs, write_tree, write_rank, write_level, write_id, num_data, data) - -### Prototype -```c -int t8_write_pvtu (const char *filename, int num_procs, int write_tree, int write_rank, int write_level, int write_id, int num_data, t8_vtk_data_field_t *data); -``` -""" -function t8_write_pvtu(filename, num_procs, write_tree, write_rank, write_level, write_id, num_data, data) - @ccall libt8.t8_write_pvtu(filename::Cstring, num_procs::Cint, write_tree::Cint, write_rank::Cint, write_level::Cint, write_id::Cint, num_data::Cint, data::Ptr{t8_vtk_data_field_t})::Cint -end - -""" - getdelim(lineptr, n, delimiter, stream) - -### Prototype -```c -static ssize_t getdelim (char **lineptr, size_t *n, int delimiter, FILE *stream); -``` -""" -function getdelim(lineptr, n, delimiter, stream) - @ccall libt8.getdelim(lineptr::Ptr{Cstring}, n::Ptr{Cint}, delimiter::Cint, stream::Ptr{Cint})::Cint -end - -""" - getline(lineptr, n, stream) - -### Prototype -```c -static ssize_t getline (char **lineptr, size_t *n, FILE *stream); -``` -""" -function getline(lineptr, n, stream) - @ccall libt8.getline(lineptr::Ptr{Cstring}, n::Ptr{Cint}, stream::Ptr{Cint})::Cint -end - -""" - strsep(stringp, delim) - -Extract token from string up to a given delimiter. - -For a full description see https://linux.die.net/man/3/[`strsep`](@ref) - -### Prototype -```c -static char * strsep (char **stringp, const char *delim); -``` -""" -function strsep(stringp, delim) - @ccall libt8.strsep(stringp::Ptr{Cstring}, delim::Cstring)::Cstring -end - -""" - t8_cmesh_copy(cmesh, cmesh_from, comm) - -### Prototype -```c -void t8_cmesh_copy (t8_cmesh_t cmesh, t8_cmesh_t cmesh_from, sc_MPI_Comm comm); -``` -""" -function t8_cmesh_copy(cmesh, cmesh_from, comm) - @ccall libt8.t8_cmesh_copy(cmesh::t8_cmesh_t, cmesh_from::t8_cmesh_t, comm::MPI_Comm)::Cvoid -end - -""" - sc_io_read(mpifile, ptr, zcount, t, errmsg) - -### Prototype -```c -void sc_io_read (sc_MPI_File mpifile, void *ptr, size_t zcount, sc_MPI_Datatype t, const char *errmsg); -``` -""" -function sc_io_read(mpifile, ptr, zcount, t, errmsg) - @ccall libsc.sc_io_read(mpifile::MPI_File, ptr::Ptr{Cvoid}, zcount::Csize_t, t::MPI_Datatype, errmsg::Cstring)::Cvoid -end - -""" - sc_io_write(mpifile, ptr, zcount, t, errmsg) - -### Prototype -```c -void sc_io_write (sc_MPI_File mpifile, const void *ptr, size_t zcount, sc_MPI_Datatype t, const char *errmsg); -``` -""" -function sc_io_write(mpifile, ptr, zcount, t, errmsg) - @ccall libsc.sc_io_write(mpifile::MPI_File, ptr::Ptr{Cvoid}, zcount::Csize_t, t::MPI_Datatype, errmsg::Cstring)::Cvoid -end - -"""Typedef for quadrant coordinates.""" -const p4est_qcoord_t = Int32 - -"""Typedef for counting topological entities (trees, tree vertices).""" -const p4est_topidx_t = Int32 - -"""Typedef for processor-local indexing of quadrants and nodes.""" -const p4est_locidx_t = Int32 - -"""Typedef for globally unique indexing of quadrants.""" -const p4est_gloidx_t = Int64 - -""" - sc_io_error_t - -Error values for io. - -| Enumerator | Note | -| :---------------------- | :--------------------------------------------------------------------------- | -| SC\\_IO\\_ERROR\\_NONE | The value of zero means no error. | -| SC\\_IO\\_ERROR\\_FATAL | The io object is now dysfunctional. | -| SC\\_IO\\_ERROR\\_AGAIN | Another io operation may resolve it. The function just returned was a noop. | -""" -@cenum sc_io_error_t::Int32 begin - SC_IO_ERROR_NONE = 0 - SC_IO_ERROR_FATAL = -1 - SC_IO_ERROR_AGAIN = -2 -end - -""" - sc_io_mode_t - -The I/O mode for writing using sc_io_sink. - -| Enumerator | Note | -| :---------------------- | :--------------------------- | -| SC\\_IO\\_MODE\\_WRITE | Semantics as "w" in fopen. | -| SC\\_IO\\_MODE\\_APPEND | Semantics as "a" in fopen. | -| SC\\_IO\\_MODE\\_LAST | Invalid entry to close list | -""" -@cenum sc_io_mode_t::UInt32 begin - SC_IO_MODE_WRITE = 0 - SC_IO_MODE_APPEND = 1 - SC_IO_MODE_LAST = 2 -end - -""" - sc_io_encode_t - -Enum to specify encoding for sc_io_sink and sc_io_source. - -| Enumerator | Note | -| :---------------------- | :--------------------------- | -| SC\\_IO\\_ENCODE\\_NONE | No encoding | -| SC\\_IO\\_ENCODE\\_LAST | Invalid entry to close list | -""" -@cenum sc_io_encode_t::UInt32 begin - SC_IO_ENCODE_NONE = 0 - SC_IO_ENCODE_LAST = 1 -end - -""" - sc_io_type_t - -The type of I/O operation sc_io_sink and sc_io_source. - -| Enumerator | Note | -| :------------------------ | :------------------------------- | -| SC\\_IO\\_TYPE\\_BUFFER | Write to a buffer | -| SC\\_IO\\_TYPE\\_FILENAME | Write to a file to be opened | -| SC\\_IO\\_TYPE\\_FILEFILE | Write to an already opened file | -| SC\\_IO\\_TYPE\\_LAST | Invalid entry to close list | -""" -@cenum sc_io_type_t::UInt32 begin - SC_IO_TYPE_BUFFER = 0 - SC_IO_TYPE_FILENAME = 1 - SC_IO_TYPE_FILEFILE = 2 - SC_IO_TYPE_LAST = 3 -end - -""" - sc_io_sink - -A generic data sink. - -| Field | Note | -| :------------- | :---------------------------------------------------- | -| iotype | type of the I/O operation | -| mode | write semantics | -| encode | encoding of data | -| buffer | buffer for the iotype SC_IO_TYPE_BUFFER | -| buffer\\_bytes | distinguish from array elements | -| file | file pointer for iotype unequal to SC_IO_TYPE_BUFFER | -| bytes\\_in | input bytes count | -| bytes\\_out | written bytes count | -| is\\_eof | Have we reached the end of file? | -""" -struct sc_io_sink - iotype::sc_io_type_t - mode::sc_io_mode_t - encode::sc_io_encode_t - buffer::Ptr{sc_array_t} - buffer_bytes::Csize_t - file::Ptr{Libc.FILE} - bytes_in::Csize_t - bytes_out::Csize_t - is_eof::Cint -end - -"""A generic data sink.""" -const sc_io_sink_t = sc_io_sink - -""" - sc_io_source - -A generic data source. - -| Field | Note | -| :-------------- | :---------------------------------------------------- | -| iotype | type of the I/O operation | -| encode | encoding of data | -| buffer | buffer for the iotype SC_IO_TYPE_BUFFER | -| buffer\\_bytes | distinguish from array elements | -| file | file pointer for iotype unequal to SC_IO_TYPE_BUFFER | -| bytes\\_in | input bytes count | -| bytes\\_out | read bytes count | -| is\\_eof | Have we reached the end of file? | -| mirror | if activated, a sink to store the data | -| mirror\\_buffer | if activated, the buffer for the mirror | -""" -struct sc_io_source - iotype::sc_io_type_t - encode::sc_io_encode_t - buffer::Ptr{sc_array_t} - buffer_bytes::Csize_t - file::Ptr{Libc.FILE} - bytes_in::Csize_t - bytes_out::Csize_t - is_eof::Cint - mirror::Ptr{sc_io_sink_t} - mirror_buffer::Ptr{sc_array_t} -end - -"""A generic data source.""" -const sc_io_source_t = sc_io_source - -""" - sc_io_open_mode_t - -Open modes for sc_io_open - -| Enumerator | Note | -| :----------------------- | :------------------------------------------------------------------------------------------------------------------ | -| SC\\_IO\\_READ | open a file in read-only mode | -| SC\\_IO\\_WRITE\\_CREATE | open a file in write-only mode; if the file exists, the file will be truncated to length zero and then overwritten | -| SC\\_IO\\_WRITE\\_APPEND | append to an already existing file | -""" -@cenum sc_io_open_mode_t::UInt32 begin - SC_IO_READ = 0 - SC_IO_WRITE_CREATE = 1 - SC_IO_WRITE_APPEND = 2 -end - -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function sc_io_sink_new(iotype, iomode, ioencode, va_list...) - :(@ccall(libsc.sc_io_sink_new(iotype::Cint, iomode::Cint, ioencode::Cint; $(to_c_type_pairs(va_list)...))::Ptr{sc_io_sink_t})) - end - -""" - sc_io_sink_destroy(sink) - -Free data sink. Calls [`sc_io_sink_complete`](@ref) and discards the final counts. Errors from complete lead to SC\\_IO\\_ERROR\\_FATAL returned from this function. Call [`sc_io_sink_complete`](@ref) yourself if bytes\\_out is of interest. - -# Arguments -* `sink`:\\[in,out\\] The sink object to complete and free. -# Returns -0 on success, nonzero on error. -### Prototype -```c -int sc_io_sink_destroy (sc_io_sink_t * sink); -``` -""" -function sc_io_sink_destroy(sink) - @ccall libsc.sc_io_sink_destroy(sink::Ptr{sc_io_sink_t})::Cint -end - -""" - sc_io_sink_destroy_null(sink) - -Free data sink and NULL the pointer to it. Except for the handling of the pointer argument, the behavior is the same as for sc_io_sink_destroy. - -# Arguments -* `sink`:\\[in,out\\] Non-NULL pointer to sink pointer. The sink pointer may be NULL, in which case this function does nothing successfully, or a valid sc_io_sink, which is passed to sc_io_sink_destroy, and the sink pointer is set to NULL afterwards. -# Returns -0 on success, nonzero on error. -### Prototype -```c -int sc_io_sink_destroy_null (sc_io_sink_t ** sink); -``` -""" -function sc_io_sink_destroy_null(sink) - @ccall libsc.sc_io_sink_destroy_null(sink::Ptr{Ptr{sc_io_sink_t}})::Cint -end - -""" - sc_io_sink_write(sink, data, bytes_avail) - -Write data to a sink. Data may be buffered and sunk in a later call. The internal counters sink->bytes\\_in and sink->bytes\\_out are updated. - -# Arguments -* `sink`:\\[in,out\\] The sink object to write to. -* `data`:\\[in\\] Data passed into sink must be non-NULL. -* `bytes_avail`:\\[in\\] Number of data bytes passed in. -# Returns -0 on success, nonzero on error. -### Prototype -```c -int sc_io_sink_write (sc_io_sink_t * sink, const void *data, size_t bytes_avail); -``` -""" -function sc_io_sink_write(sink, data, bytes_avail) - @ccall libsc.sc_io_sink_write(sink::Ptr{sc_io_sink_t}, data::Ptr{Cvoid}, bytes_avail::Csize_t)::Cint -end - -""" - sc_io_sink_complete(sink, bytes_in, bytes_out) - -Flush all buffered output data to sink. This function may return SC\\_IO\\_ERROR\\_AGAIN if another write is required. Currently this may happen if BUFFER requires an integer multiple of bytes. If successful, the updated value of bytes read and written is returned in bytes\\_in/out, and the sink status is reset as if the sink had just been created. In particular, the bytes counters are reset to zero. The internal state of the sink is not changed otherwise. It is legal to continue writing to the sink hereafter. The sink actions taken depend on its type. BUFFER, FILEFILE: none. FILENAME: call fclose on sink->file. - -# Arguments -* `sink`:\\[in,out\\] The sink object to write to. -* `bytes_in`:\\[in,out\\] Bytes received since the last new or complete call. May be NULL. -* `bytes_out`:\\[in,out\\] Bytes written since the last new or complete call. May be NULL. -# Returns -0 if completed, nonzero on error. -### Prototype -```c -int sc_io_sink_complete (sc_io_sink_t * sink, size_t *bytes_in, size_t *bytes_out); -``` -""" -function sc_io_sink_complete(sink, bytes_in, bytes_out) - @ccall libsc.sc_io_sink_complete(sink::Ptr{sc_io_sink_t}, bytes_in::Ptr{Csize_t}, bytes_out::Ptr{Csize_t})::Cint -end - -""" - sc_io_sink_align(sink, bytes_align) - -Align sink to a byte boundary by writing zeros. - -# Arguments -* `sink`:\\[in,out\\] The sink object to align. -* `bytes_align`:\\[in\\] Byte boundary. -# Returns -0 on success, nonzero on error. -### Prototype -```c -int sc_io_sink_align (sc_io_sink_t * sink, size_t bytes_align); -``` -""" -function sc_io_sink_align(sink, bytes_align) - @ccall libsc.sc_io_sink_align(sink::Ptr{sc_io_sink_t}, bytes_align::Csize_t)::Cint -end - -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function sc_io_source_new(iotype, ioencode, va_list...) - :(@ccall(libsc.sc_io_source_new(iotype::Cint, ioencode::Cint; $(to_c_type_pairs(va_list)...))::Ptr{sc_io_source_t})) - end - -""" - sc_io_source_destroy(source) - -Free data source. Calls [`sc_io_source_complete`](@ref) and requires it to return no error. This is to avoid discarding buffered data that has not been passed to read. - -# Arguments -* `source`:\\[in,out\\] The source object to free. -# Returns -0 on success. Nonzero if an error is encountered or is\\_complete returns one. -### Prototype -```c -int sc_io_source_destroy (sc_io_source_t * source); -``` -""" -function sc_io_source_destroy(source) - @ccall libsc.sc_io_source_destroy(source::Ptr{sc_io_source_t})::Cint -end - -""" - sc_io_source_destroy_null(source) - -Free data source and NULL the pointer to it. Except for the handling of the pointer argument, the behavior is the same as for sc_io_source_destroy. - -# Arguments -* `source`:\\[in,out\\] Non-NULL pointer to source pointer. The source pointer may be NULL, in which case this function does nothing successfully, or a valid sc_io_source, which is passed to sc_io_source_destroy, and the source pointer is set to NULL afterwards. -# Returns -0 on success, nonzero on error. -### Prototype -```c -int sc_io_source_destroy_null (sc_io_source_t ** source); -``` -""" -function sc_io_source_destroy_null(source) - @ccall libsc.sc_io_source_destroy_null(source::Ptr{Ptr{sc_io_source_t}})::Cint -end - -""" - sc_io_source_read(source, data, bytes_avail, bytes_out) - -Read data from a source. The internal counters source->bytes\\_in and source->bytes\\_out are updated. Data is read until the data buffer has not enough room anymore, or source becomes empty. It is possible that data already read internally remains in the source object for the next call. Call [`sc_io_source_complete`](@ref) and check its return value to find out. Returns an error if bytes\\_out is NULL and less than bytes\\_avail are read. - -# Arguments -* `source`:\\[in,out\\] The source object to read from. -* `data`:\\[in\\] Data buffer for reading from source. If NULL the output data will be ignored and we seek forward in the input. -* `bytes_avail`:\\[in\\] Number of bytes available in data buffer. -* `bytes_out`:\\[in,out\\] If not NULL, byte count read into data buffer. Otherwise, requires to read exactly bytes\\_avail. If this condition is not met, return an error. -# Returns -0 on success, nonzero on error. -### Prototype -```c -int sc_io_source_read (sc_io_source_t * source, void *data, size_t bytes_avail, size_t *bytes_out); -``` -""" -function sc_io_source_read(source, data, bytes_avail, bytes_out) - @ccall libsc.sc_io_source_read(source::Ptr{sc_io_source_t}, data::Ptr{Cvoid}, bytes_avail::Csize_t, bytes_out::Ptr{Csize_t})::Cint -end - -""" - sc_io_source_complete(source, bytes_in, bytes_out) - -Determine whether all data buffered from source has been returned by read. If it returns SC\\_IO\\_ERROR\\_AGAIN, another [`sc_io_source_read`](@ref) is required. If the call returns no error, the internal counters source->bytes\\_in and source->bytes\\_out are returned to the caller if requested, and reset to 0. The internal state of the source is not changed otherwise. It is legal to continue reading from the source hereafter. - -# Arguments -* `source`:\\[in,out\\] The source object to read from. -* `bytes_in`:\\[in,out\\] If not NULL and true is returned, the total size of the data sourced. -* `bytes_out`:\\[in,out\\] If not NULL and true is returned, total bytes passed out by source\\_read. -# Returns -SC\\_IO\\_ERROR\\_AGAIN if buffered data remaining. Otherwise return ERROR\\_NONE and reset counters. -### Prototype -```c -int sc_io_source_complete (sc_io_source_t * source, size_t *bytes_in, size_t *bytes_out); -``` -""" -function sc_io_source_complete(source, bytes_in, bytes_out) - @ccall libsc.sc_io_source_complete(source::Ptr{sc_io_source_t}, bytes_in::Ptr{Csize_t}, bytes_out::Ptr{Csize_t})::Cint -end - -""" - sc_io_source_align(source, bytes_align) - -Align source to a byte boundary by skipping. - -# Arguments -* `source`:\\[in,out\\] The source object to align. -* `bytes_align`:\\[in\\] Byte boundary. -# Returns -0 on success, nonzero on error. -### Prototype -```c -int sc_io_source_align (sc_io_source_t * source, size_t bytes_align); -``` +| Field | Note | +| :------ | :--------------------------------- | +| ntree | The number of the tree | +| nedge | The number of the edge | +| naxis | The 3 edge coordinate axes | +| nflip | The orientation of the edge | +| corners | The corners connected to the edge | """ -function sc_io_source_align(source, bytes_align) - @ccall libsc.sc_io_source_align(source::Ptr{sc_io_source_t}, bytes_align::Csize_t)::Cint +struct p8est_edge_transform_t + ntree::p4est_topidx_t + nedge::Int8 + naxis::NTuple{3, Int8} + nflip::Int8 + corners::Int8 end """ - sc_io_source_activate_mirror(source) + p8est_edge_info_t -Activate a buffer that mirrors (i.e., stores) the data that was read. +Information about the neighbors of an edge -# Arguments -* `source`:\\[in,out\\] The source object to activate mirror in. -# Returns -0 on success, nonzero on error. -### Prototype -```c -int sc_io_source_activate_mirror (sc_io_source_t * source); -``` +| Field | Note | +| :---------------- | :---------------------------------------------- | +| iedge | The information of the edge | +| edge\\_transforms | The array of neighbors of the originating edge | """ -function sc_io_source_activate_mirror(source) - @ccall libsc.sc_io_source_activate_mirror(source::Ptr{sc_io_source_t})::Cint +struct p8est_edge_info_t + iedge::Int8 + edge_transforms::sc_array_t end """ - sc_io_source_read_mirror(source, data, bytes_avail, bytes_out) + p8est_corner_transform_t -Read data from the source's mirror. Same behaviour as [`sc_io_source_read`](@ref). +Generic interface for transformations between a tree and any of its corner -# Arguments -* `source`:\\[in,out\\] The source object to read mirror data from. -* `data`:\\[in\\] Data buffer for reading from source's mirror. If NULL the output data will be thrown away. -* `bytes_avail`:\\[in\\] Number of bytes available in data buffer. -* `bytes_out`:\\[in,out\\] If not NULL, byte count read into data buffer. Otherwise, requires to read exactly bytes\\_avail. -# Returns -0 on success, nonzero on error. -### Prototype -```c -int sc_io_source_read_mirror (sc_io_source_t * source, void *data, size_t bytes_avail, size_t *bytes_out); -``` +| Field | Note | +| :------ | :------------------------ | +| ntree | The number of the tree | +| ncorner | The number of the corner | """ -function sc_io_source_read_mirror(source, data, bytes_avail, bytes_out) - @ccall libsc.sc_io_source_read_mirror(source::Ptr{sc_io_source_t}, data::Ptr{Cvoid}, bytes_avail::Csize_t, bytes_out::Ptr{Csize_t})::Cint +struct p8est_corner_transform_t + ntree::p4est_topidx_t + ncorner::Int8 end """ - sc_io_file_save(filename, buffer) + p8est_corner_info_t -Save a buffer to a file in one call. This function performs error checking and always returns cleanly. +Information about the neighbors of a corner -# Arguments -* `filename`:\\[in\\] Name of the file to save. -* `buffer`:\\[in\\] An array of element size 1 and arbitrary contents, which are written to the file. -# Returns -0 on success, -1 on error. -### Prototype -```c -int sc_io_file_save (const char *filename, sc_array_t * buffer); -``` +| Field | Note | +| :------------------ | :------------------------------------------------ | +| icorner | The number of the originating corner | +| corner\\_transforms | The array of neighbors of the originating corner | """ -function sc_io_file_save(filename, buffer) - @ccall libsc.sc_io_file_save(filename::Cstring, buffer::Ptr{sc_array_t})::Cint +struct p8est_corner_info_t + icorner::p4est_topidx_t + corner_transforms::sc_array_t end """ - sc_io_file_load(filename, buffer) + p8est_neighbor_transform_t -Read a file into a buffer in one call. This function performs error checking and always returns cleanly. +Generic interface for transformations between a tree and any of its neighbors -# Arguments -* `filename`:\\[in\\] Name of the file to load. -* `buffer`:\\[in,out\\] On input, an array (not a view) of element size 1 and arbitrary contents. On output and success, the complete file contents. On error, contents are undefined. -# Returns -0 on success, -1 on error. -### Prototype -```c -int sc_io_file_load (const char *filename, sc_array_t * buffer); -``` +| Field | Note | +| :---------------- | :-------------------------------------------------------------------------- | +| neighbor\\_type | type of connection to neighbor | +| neighbor | neighbor tree index | +| index\\_self | index of interface from self's perspective | +| index\\_neighbor | index of interface from neighbor's perspective | +| perm | permutation of dimensions when transforming self coords to neighbor coords | +| sign | sign changes when transforming self coords to neighbor coords | +| origin\\_self | point on the interface from self's perspective | +| origin\\_neighbor | point on the interface from neighbor's perspective | """ -function sc_io_file_load(filename, buffer) - @ccall libsc.sc_io_file_load(filename::Cstring, buffer::Ptr{sc_array_t})::Cint +struct p8est_neighbor_transform_t + neighbor_type::p8est_connect_type_t + neighbor::p4est_topidx_t + index_self::Int8 + index_neighbor::Int8 + perm::NTuple{3, Int8} + sign::NTuple{3, Int8} + origin_self::NTuple{3, p4est_qcoord_t} + origin_neighbor::NTuple{3, p4est_qcoord_t} end """ - sc_io_encode(data, out) - -Encode a block of arbitrary data with the default sc\\_io format. The corresponding decoder function is sc_io_decode. This function cannot crash unless out of memory. - -Currently this function calls sc_io_encode_zlib with compression level Z\\_BEST\\_COMPRESSION (subject to change). Without zlib configured that function works uncompressed. + p8est_neighbor_transform_coordinates(nt, self_coords, neigh_coords) -The encoding method and input data size can be retrieved, optionally, from the encoded data by sc_io_decode_info. This function decodes the method as a character, which is 'z' for sc_io_encode_zlib. We reserve the characters A-C, d-z indefinitely. +Transform from self's coordinate system to neighbor's coordinate system. # Arguments -* `data`:\\[in,out\\] If *out* is NULL, we work in place. In this case, the array must on input have an element size of 1 byte, which is preserved. After reading all data from this array, it assumes the identity of the *out* argument below. Otherwise, this is a read-only argument that may have arbitrary element size. On input, all data in the array is used. -* `out`:\\[in,out\\] If not NULL, a valid array of element size 1. It must be resizable (not a view). We resize the array to the output data, which always includes a final terminating zero. +* `nt`:\\[in\\] A neighbor transform. +* `self_coords`:\\[in\\] Input quadrant coordinates in self coordinates. +* `neigh_coords`:\\[out\\] Coordinates transformed into neighbor coordinates. ### Prototype ```c -void sc_io_encode (sc_array_t *data, sc_array_t *out); +void p8est_neighbor_transform_coordinates (const p8est_neighbor_transform_t * nt, const p4est_qcoord_t self_coords[P8EST_DIM], p4est_qcoord_t neigh_coords[P8EST_DIM]); ``` """ -function sc_io_encode(data, out) - @ccall libsc.sc_io_encode(data::Ptr{sc_array_t}, out::Ptr{sc_array_t})::Cvoid +function p8est_neighbor_transform_coordinates(nt, self_coords, neigh_coords) + @ccall libt8.p8est_neighbor_transform_coordinates(nt::Ptr{p8est_neighbor_transform_t}, self_coords::Ptr{p4est_qcoord_t}, neigh_coords::Ptr{p4est_qcoord_t})::Cvoid end """ - sc_io_encode_zlib(data, out, zlib_compression_level, line_break_character) - -Encode a block of arbitrary data, compressed, into an ASCII string. This is a two-stage process: zlib compress and then encode to base 64. The output is a NUL-terminated string of printable characters. - -We first compress the data into the zlib deflate format (RFC 1951). The compressor must use no preset dictionary (this is the default). If zlib is detected on configuration, we compress with the given level. If zlib is not detected, we write data equivalent to Z\\_NO\\_COMPRESSION. The status of zlib detection can be queried at compile time using #ifdef [`SC_HAVE_ZLIB`](@ref) or at run time using sc_have_zlib. Both types of result are readable by a standard zlib uncompress call. - -Secondly, we process the input data size as an 8-byte big-endian number, then the letter 'z', and then the zlib compressed data, concatenated, with a base 64 encoder. We break lines after 76 code characters. Each line break consists of two configurable but arbitrary bytes. The line breaks are considered part of the output data specification. The last line is terminated with the same line break and then a NUL. + p8est_neighbor_transform_coordinates_reverse(nt, neigh_coords, self_coords) -This routine can work in place or write to an output array. The corresponding decoder function is sc_io_decode. This function cannot crash unless out of memory. +Transform from neighbor's coordinate system to self's coordinate system. # Arguments -* `data`:\\[in,out\\] If *out* is NULL, we work in place. In this case, the array must on input have an element size of 1 byte, which is preserved. After reading all data from this array, it assumes the identity of the *out* argument below. Otherwise, this is a read-only argument that may have arbitrary element size. On input, all data in the array is used. -* `out`:\\[in,out\\] If not NULL, a valid array of element size 1. It must be resizable (not a view). We resize the array to the output data, which always includes a final terminating zero. -* `zlib_compression_level`:\\[in\\] Compression level between 0 (no compression) and 9 (best compression). The value -1 indicates some default level. -* `line_break_character`:\\[in\\] This character is arbitrary and specifies the first of two line break bytes. The second byte is always ''. +* `nt`:\\[in\\] A neighbor transform. +* `neigh_coords`:\\[in\\] Input quadrant coordinates in self coordinates. +* `self_coords`:\\[out\\] Coordinates transformed into neighbor coordinates. ### Prototype ```c -void sc_io_encode_zlib (sc_array_t *data, sc_array_t *out, int zlib_compression_level, int line_break_character); +void p8est_neighbor_transform_coordinates_reverse (const p8est_neighbor_transform_t * nt, const p4est_qcoord_t neigh_coords[P8EST_DIM], p4est_qcoord_t self_coords[P8EST_DIM]); ``` """ -function sc_io_encode_zlib(data, out, zlib_compression_level, line_break_character) - @ccall libsc.sc_io_encode_zlib(data::Ptr{sc_array_t}, out::Ptr{sc_array_t}, zlib_compression_level::Cint, line_break_character::Cint)::Cvoid +function p8est_neighbor_transform_coordinates_reverse(nt, neigh_coords, self_coords) + @ccall libt8.p8est_neighbor_transform_coordinates_reverse(nt::Ptr{p8est_neighbor_transform_t}, neigh_coords::Ptr{p4est_qcoord_t}, self_coords::Ptr{p4est_qcoord_t})::Cvoid end """ - sc_io_decode_info(data, original_size, format_char, re) - -Decode length and format of original input from encoded data. We expect at least 12 bytes of the format produced by sc_io_encode. No matter how much data has been encoded by it, this much is available. We decode the original data size and the character indicating the format. - -This function does not require zlib. It works with any well-defined data. + p8est_connectivity_get_neighbor_transforms(conn, tree_id, boundary_type, boundary_index, neighbor_transform_array) -Note that this function is not required before sc_io_decode. Calling this function on any result produced by sc_io_encode will succeed and report a legal format. This function cannot crash. +Fill an array with the neighbor transforms based on a specific boundary type. This function generalizes all other inter-tree transformation objects # Arguments -* `data`:\\[in\\] This must be an array with element size 1. If it contains less than 12 code bytes we error out. It its first 12 bytes do not base 64 decode to 9 bytes we error out. We generally ignore the remaining data. -* `original_size`:\\[out\\] If not NULL and we do not error out, set to the original size as encoded in the data. -* `format_char`:\\[out\\] If not NULL and we do not error out, the ninth character of decoded data indicating the format. -* `re`:\\[in,out\\] Provided for error reporting, presently must be NULL. -# Returns -0 on success, negative value on error. +* `conn`:\\[in\\] Connectivity structure. +* `tree_id`:\\[in\\] The number of the tree. +* `boundary_type`:\\[in\\] Type of boundary connection (self, face, edge, corner). +* `boundary_index`:\\[in\\] The index of the boundary. +* `neighbor_transform_array`:\\[in,out\\] Array of the neighbor transforms. ### Prototype ```c -int sc_io_decode_info (sc_array_t *data, size_t *original_size, char *format_char, void *re); +void p8est_connectivity_get_neighbor_transforms (p8est_connectivity_t *conn, p4est_topidx_t tree_id, p8est_connect_type_t boundary_type, int boundary_index, sc_array_t *neighbor_transform_array); ``` """ -function sc_io_decode_info(data, original_size, format_char, re) - @ccall libsc.sc_io_decode_info(data::Ptr{sc_array_t}, original_size::Ptr{Csize_t}, format_char::Cstring, re::Ptr{Cvoid})::Cint +function p8est_connectivity_get_neighbor_transforms(conn, tree_id, boundary_type, boundary_index, neighbor_transform_array) + @ccall libt8.p8est_connectivity_get_neighbor_transforms(conn::Ptr{p8est_connectivity_t}, tree_id::p4est_topidx_t, boundary_type::p8est_connect_type_t, boundary_index::Cint, neighbor_transform_array::Ptr{sc_array_t})::Cvoid end """ - sc_io_decode(data, out, max_original_size, re) - -Decode a block of base 64 encoded compressed data. The base 64 data must contain two arbitrary bytes after every 76 code characters and also at the end of the last line if it is short, and then a final NUL character. This function does not require zlib but benefits for speed. - -This is a two-stage process: we decode the input from base 64 first. Then we extract the 8-byte big-endian original data size, the character 'z', and execute a zlib decompression on the remaining decoded data. This function detects malformed input by erroring out. + p8est_connectivity_coordinates_canonicalize(conn, treeid, coords, treeid_out, coords_out) -If we should add another format in the future, the format character may be something else than 'z', as permitted by our specification. To this end, we reserve the characters A-C and d-z indefinitely. - -Any error condition is indicated by a negative return value. Possible causes for error are: - -- the input data string is not NUL-terminated - the first 12 characters of input do not decode properly - the input data is corrupt for decoding or decompression - the output data array has non-unit element size and the length of the output data is not divisible by the size - the output data would exceed the specified threshold - the output array is a view of insufficient length +Determine the owning tree for a coordinate and transform it there. -We also error out if the data requires a compression dictionary, which would be a violation of above encode format specification. +On a boundary between trees, different coordinate systems meet. A coordinate on a tree boundary face, edge, or corner generated from the perspective of a specific tree may be transformed into any other touching tree's coordinate system and still refer to the same point in the mesh. -The corresponding encode function is sc_io_encode. When passing an array as output, we resize it properly. This function cannot crash unless out of memory. +To uniquely identify a coordinate, this function identifies the lowest numbered tree touching this coordinate and transforms the coordinate into that system. The result can be used e. g. in topology hash tables. # Arguments -* `data`:\\[in,out\\] If *out* is NULL, we work in place. In that case, output is written into this array after a suitable resize. Either way, we expect a NUL-terminated base 64 encoded string on input that has in turn been obtained by zlib compression. It must be in the exact format produced by sc_io_encode; please see documentation. The element size of the input array must be 1. -* `out`:\\[in,out\\] If not NULL, a valid array (may be a view). If NULL, the input array becomes the output. If the output array is a view and the output data larger than its view size, we error out. We expect commensurable element and data size and resize the output to fit exactly, which restores the original input passed to encoding. An output view array of matching size may be constructed using sc_io_decode_info. -* `max_original_size`:\\[in\\] If nonzero, this is the maximal data size that we will accept after uncompression. If exceeded, return a negative value. -* `re`:\\[in,out\\] Provided for error reporting, presently must be NULL. -# Returns -0 on success, negative on malformed input data or insufficient output space. +* `conn`:\\[in\\] A valid connectivity. +* `treeid`:\\[in\\] The original tree index for this coordinate tuple. +* `coords`:\\[in\\] A valid coordinate 2-tuple relative to *treeid*. +* `treeid_out`:\\[out\\] The lowest tree index touching the coordinate. +* `coords_out`:\\[out\\] The input coordinates, if necessary after transformation into the system of the lowest numbered tree, returned in *treeid_out*. ### Prototype ```c -int sc_io_decode (sc_array_t *data, sc_array_t *out, size_t max_original_size, void *re); +void p8est_connectivity_coordinates_canonicalize (p8est_connectivity_t *conn, p4est_topidx_t treeid, const p4est_qcoord_t coords[], p4est_topidx_t *treeid_out, p4est_qcoord_t coords_out[]); ``` """ -function sc_io_decode(data, out, max_original_size, re) - @ccall libsc.sc_io_decode(data::Ptr{sc_array_t}, out::Ptr{sc_array_t}, max_original_size::Csize_t, re::Ptr{Cvoid})::Cint +function p8est_connectivity_coordinates_canonicalize(conn, treeid, coords, treeid_out, coords_out) + @ccall libt8.p8est_connectivity_coordinates_canonicalize(conn::Ptr{p8est_connectivity_t}, treeid::p4est_topidx_t, coords::Ptr{p4est_qcoord_t}, treeid_out::Ptr{p4est_topidx_t}, coords_out::Ptr{p4est_qcoord_t})::Cvoid end """ - sc_vtk_write_binary(vtkfile, numeric_data, byte_length) + p8est_connectivity_face_neighbor_corner_set(c, f, nf, set) -This function writes numeric binary data in VTK base64 encoding. +Transform a corner across one of the adjacent faces into a neighbor tree. It expects a face permutation index that has been precomputed. # Arguments -* `vtkfile`: Stream opened for writing. -* `numeric_data`: A pointer to a numeric data array. -* `byte_length`: The length of the data array in bytes. +* `c`:\\[in\\] A corner number in 0..7. +* `f`:\\[in\\] A face number that touches the corner *c*. +* `nf`:\\[in\\] A neighbor face that is on the other side of *f*. +* `set`:\\[in\\] A value from *p8est_face_permutation_sets* that is obtained using *f*, *nf*, and a valid orientation: ref = p8est\\_face\\_permutation\\_refs[f][nf]; set = p8est\\_face\\_permutation\\_sets[ref][orientation]; # Returns -Returns 0 on success, -1 on file error. +The corner number in 0..7 seen from the other face. ### Prototype ```c -int sc_vtk_write_binary (FILE * vtkfile, char *numeric_data, size_t byte_length); +int p8est_connectivity_face_neighbor_corner_set (int c, int f, int nf, int set); ``` """ -function sc_vtk_write_binary(vtkfile, numeric_data, byte_length) - @ccall libsc.sc_vtk_write_binary(vtkfile::Ptr{Libc.FILE}, numeric_data::Cstring, byte_length::Csize_t)::Cint +function p8est_connectivity_face_neighbor_corner_set(c, f, nf, set) + @ccall libt8.p8est_connectivity_face_neighbor_corner_set(c::Cint, f::Cint, nf::Cint, set::Cint)::Cint end """ - sc_vtk_write_compressed(vtkfile, numeric_data, byte_length) + p8est_connectivity_face_neighbor_face_corner(fc, f, nf, o) -This function writes numeric binary data in VTK compressed format. +Transform a face corner across one of the adjacent faces into a neighbor tree. This version expects the neighbor face and orientation separately. # Arguments -* `vtkfile`: Stream opened for writing. -* `numeric_data`: A pointer to a numeric data array. -* `byte_length`: The length of the data array in bytes. +* `fc`:\\[in\\] A face corner number in 0..3. +* `f`:\\[in\\] A face that the face corner *fc* is relative to. +* `nf`:\\[in\\] A neighbor face that is on the other side of *f*. +* `o`:\\[in\\] The orientation between tree boundary faces *f* and *nf*. # Returns -Returns 0 on success, -1 on file error. +The face corner number relative to the neighbor's face. ### Prototype ```c -int sc_vtk_write_compressed (FILE * vtkfile, char *numeric_data, size_t byte_length); +int p8est_connectivity_face_neighbor_face_corner (int fc, int f, int nf, int o); ``` """ -function sc_vtk_write_compressed(vtkfile, numeric_data, byte_length) - @ccall libsc.sc_vtk_write_compressed(vtkfile::Ptr{Libc.FILE}, numeric_data::Cstring, byte_length::Csize_t)::Cint +function p8est_connectivity_face_neighbor_face_corner(fc, f, nf, o) + @ccall libt8.p8est_connectivity_face_neighbor_face_corner(fc::Cint, f::Cint, nf::Cint, o::Cint)::Cint end """ - sc_fopen(filename, mode, errmsg) + p8est_connectivity_face_neighbor_corner(c, f, nf, o) -Wrapper for fopen(3). We provide an additional argument that contains the error message. +Transform a corner across one of the adjacent faces into a neighbor tree. This version expects the neighbor face and orientation separately. +# Arguments +* `c`:\\[in\\] A corner number in 0..7. +* `f`:\\[in\\] A face number that touches the corner *c*. +* `nf`:\\[in\\] A neighbor face that is on the other side of *f*. +* `o`:\\[in\\] The orientation between tree boundary faces *f* and *nf*. +# Returns +The number of the corner seen from the neighbor tree. ### Prototype ```c -FILE *sc_fopen (const char *filename, const char *mode, const char *errmsg); +int p8est_connectivity_face_neighbor_corner (int c, int f, int nf, int o); ``` """ -function sc_fopen(filename, mode, errmsg) - @ccall libsc.sc_fopen(filename::Cstring, mode::Cstring, errmsg::Cstring)::Ptr{Libc.FILE} +function p8est_connectivity_face_neighbor_corner(c, f, nf, o) + @ccall libt8.p8est_connectivity_face_neighbor_corner(c::Cint, f::Cint, nf::Cint, o::Cint)::Cint end """ - sc_fwrite(ptr, size, nmemb, file, errmsg) - -Write memory content to a file. - -!!! note + p8est_connectivity_face_neighbor_face_edge(fe, f, nf, o) - This function aborts on file errors. +Transform a face-edge across one of the adjacent faces into a neighbor tree. This version expects the neighbor face and orientation separately. # Arguments -* `ptr`:\\[in\\] Data array to write to disk. -* `size`:\\[in\\] Size of one array member. -* `nmemb`:\\[in\\] Number of array members. -* `file`:\\[in,out\\] File pointer, must be opened for writing. -* `errmsg`:\\[in\\] Error message passed to `SC_CHECK_ABORT`. +* `fe`:\\[in\\] A face edge number in 0..3. +* `f`:\\[in\\] A face number that touches the edge *e*. +* `nf`:\\[in\\] A neighbor face that is on the other side of *f*. +* `o`:\\[in\\] The orientation between tree boundary faces *f* and *nf*. +# Returns +The face edge number seen from the neighbor tree. ### Prototype ```c -void sc_fwrite (const void *ptr, size_t size, size_t nmemb, FILE * file, const char *errmsg); +int p8est_connectivity_face_neighbor_face_edge (int fe, int f, int nf, int o); ``` """ -function sc_fwrite(ptr, size, nmemb, file, errmsg) - @ccall libsc.sc_fwrite(ptr::Ptr{Cvoid}, size::Csize_t, nmemb::Csize_t, file::Ptr{Libc.FILE}, errmsg::Cstring)::Cvoid +function p8est_connectivity_face_neighbor_face_edge(fe, f, nf, o) + @ccall libt8.p8est_connectivity_face_neighbor_face_edge(fe::Cint, f::Cint, nf::Cint, o::Cint)::Cint end """ - sc_fread(ptr, size, nmemb, file, errmsg) - -Read file content into memory. - -!!! note + p8est_connectivity_face_neighbor_edge(e, f, nf, o) - This function aborts on file errors. +Transform an edge across one of the adjacent faces into a neighbor tree. This version expects the neighbor face and orientation separately. # Arguments -* `ptr`:\\[out\\] Data array to read from disk. -* `size`:\\[in\\] Size of one array member. -* `nmemb`:\\[in\\] Number of array members. -* `file`:\\[in,out\\] File pointer, must be opened for reading. -* `errmsg`:\\[in\\] Error message passed to `SC_CHECK_ABORT`. +* `e`:\\[in\\] A edge number in 0..11. +* `f`:\\[in\\] A face 0..5 that touches the edge *e*. +* `nf`:\\[in\\] A neighbor face that is on the other side of *f*. +* `o`:\\[in\\] The orientation between tree boundary faces *f* and *nf*. +# Returns +The edge's number seen from the neighbor. ### Prototype ```c -void sc_fread (void *ptr, size_t size, size_t nmemb, FILE * file, const char *errmsg); +int p8est_connectivity_face_neighbor_edge (int e, int f, int nf, int o); ``` """ -function sc_fread(ptr, size, nmemb, file, errmsg) - @ccall libsc.sc_fread(ptr::Ptr{Cvoid}, size::Csize_t, nmemb::Csize_t, file::Ptr{Libc.FILE}, errmsg::Cstring)::Cvoid +function p8est_connectivity_face_neighbor_edge(e, f, nf, o) + @ccall libt8.p8est_connectivity_face_neighbor_edge(e::Cint, f::Cint, nf::Cint, o::Cint)::Cint end """ - sc_fflush_fsync_fclose(file) + p8est_connectivity_edge_neighbor_edge_corner(ec, o) -Best effort to flush a file's data to disc and close it. +Transform an edge corner across one of the adjacent edges into a neighbor tree. # Arguments -* `file`:\\[in,out\\] File open for writing. +* `ec`:\\[in\\] An edge corner number in 0..1. +* `o`:\\[in\\] The orientation of a tree boundary edge connection. +# Returns +The edge corner number seen from the other tree. ### Prototype ```c -void sc_fflush_fsync_fclose (FILE * file); +int p8est_connectivity_edge_neighbor_edge_corner (int ec, int o); ``` """ -function sc_fflush_fsync_fclose(file) - @ccall libsc.sc_fflush_fsync_fclose(file::Ptr{Libc.FILE})::Cvoid +function p8est_connectivity_edge_neighbor_edge_corner(ec, o) + @ccall libt8.p8est_connectivity_edge_neighbor_edge_corner(ec::Cint, o::Cint)::Cint end """ - sc_io_open(mpicomm, filename, amode, mpiinfo, mpifile) - -### Prototype -```c -int sc_io_open (sc_MPI_Comm mpicomm, const char *filename, sc_io_open_mode_t amode, sc_MPI_Info mpiinfo, sc_MPI_File * mpifile); -``` -""" -function sc_io_open(mpicomm, filename, amode, mpiinfo, mpifile) - @ccall libsc.sc_io_open(mpicomm::MPI_Comm, filename::Cstring, amode::sc_io_open_mode_t, mpiinfo::Cint, mpifile::Ptr{Cint})::Cint -end + p8est_connectivity_edge_neighbor_corner(c, e, ne, o) -""" - sc_io_read_at(mpifile, offset, ptr, count, t, ocount) +Transform a corner across one of the adjacent edges into a neighbor tree. This version expects the neighbor edge and orientation separately. +# Arguments +* `c`:\\[in\\] A corner number in 0..7. +* `e`:\\[in\\] An edge 0..11 that touches the corner *c*. +* `ne`:\\[in\\] A neighbor edge that is on the other side of *e*. +* `o`:\\[in\\] The orientation between tree boundary edges *e* and *ne*. +# Returns +Corner number seen from the neighbor. ### Prototype ```c -int sc_io_read_at (sc_MPI_File mpifile, sc_MPI_Offset offset, void *ptr, int count, sc_MPI_Datatype t, int *ocount); +int p8est_connectivity_edge_neighbor_corner (int c, int e, int ne, int o); ``` """ -function sc_io_read_at(mpifile, offset, ptr, count, t, ocount) - @ccall libsc.sc_io_read_at(mpifile::MPI_File, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::MPI_Datatype, ocount::Ptr{Cint})::Cint +function p8est_connectivity_edge_neighbor_corner(c, e, ne, o) + @ccall libt8.p8est_connectivity_edge_neighbor_corner(c::Cint, e::Cint, ne::Cint, o::Cint)::Cint end """ - sc_io_read_at_all(mpifile, offset, ptr, count, t, ocount) + p8est_connectivity_new(num_vertices, num_trees, num_edges, num_ett, num_corners, num_ctt) + +Allocate a connectivity structure. The attribute fields are initialized to NULL. +# Arguments +* `num_vertices`:\\[in\\] Number of total vertices (i.e. geometric points). +* `num_trees`:\\[in\\] Number of trees in the forest. +* `num_edges`:\\[in\\] Number of tree-connecting edges. +* `num_ett`:\\[in\\] Number of total trees in edge\\_to\\_tree array. +* `num_corners`:\\[in\\] Number of tree-connecting corners. +* `num_ctt`:\\[in\\] Number of total trees in corner\\_to\\_tree array. +# Returns +A connectivity structure with allocated arrays. ### Prototype ```c -int sc_io_read_at_all (sc_MPI_File mpifile, sc_MPI_Offset offset, void *ptr, int count, sc_MPI_Datatype t, int *ocount); +p8est_connectivity_t *p8est_connectivity_new (p4est_topidx_t num_vertices, p4est_topidx_t num_trees, p4est_topidx_t num_edges, p4est_topidx_t num_ett, p4est_topidx_t num_corners, p4est_topidx_t num_ctt); ``` """ -function sc_io_read_at_all(mpifile, offset, ptr, count, t, ocount) - @ccall libsc.sc_io_read_at_all(mpifile::MPI_File, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::MPI_Datatype, ocount::Ptr{Cint})::Cint +function p8est_connectivity_new(num_vertices, num_trees, num_edges, num_ett, num_corners, num_ctt) + @ccall libt8.p8est_connectivity_new(num_vertices::p4est_topidx_t, num_trees::p4est_topidx_t, num_edges::p4est_topidx_t, num_ett::p4est_topidx_t, num_corners::p4est_topidx_t, num_ctt::p4est_topidx_t)::Ptr{p8est_connectivity_t} end """ - sc_io_write_at(mpifile, offset, ptr, count, t, ocount) + p8est_connectivity_new_copy(num_vertices, num_trees, num_edges, num_corners, vertices, ttv, ttt, ttf, tte, eoff, ett, ete, ttc, coff, ctt, ctc) +Allocate a connectivity structure and populate from constants. The attribute fields are initialized to NULL. + +# Arguments +* `num_vertices`:\\[in\\] Number of total vertices (i.e. geometric points). +* `num_trees`:\\[in\\] Number of trees in the forest. +* `num_edges`:\\[in\\] Number of tree-connecting edges. +* `num_corners`:\\[in\\] Number of tree-connecting corners. +* `vertices`:\\[in\\] Coordinates of the vertices of the trees. +* `ttv`:\\[in\\] The tree-to-vertex array. +* `ttt`:\\[in\\] The tree-to-tree array. +* `ttf`:\\[in\\] The tree-to-face array (int8\\_t). +* `tte`:\\[in\\] The tree-to-edge array. +* `eoff`:\\[in\\] Edge-to-tree offsets (num\\_edges + 1 values). This must always be non-NULL; in trivial cases it is just a pointer to a p4est\\_topix value of 0. +* `ett`:\\[in\\] The edge-to-tree array. +* `ete`:\\[in\\] The edge-to-edge array. +* `ttc`:\\[in\\] The tree-to-corner array. +* `coff`:\\[in\\] Corner-to-tree offsets (num\\_corners + 1 values). This must always be non-NULL; in trivial cases it is just a pointer to a p4est\\_topix value of 0. +* `ctt`:\\[in\\] The corner-to-tree array. +* `ctc`:\\[in\\] The corner-to-corner array. +# Returns +The connectivity is checked for validity. ### Prototype ```c -int sc_io_write_at (sc_MPI_File mpifile, sc_MPI_Offset offset, const void *ptr, int count, sc_MPI_Datatype t, int *ocount); +p8est_connectivity_t *p8est_connectivity_new_copy (p4est_topidx_t num_vertices, p4est_topidx_t num_trees, p4est_topidx_t num_edges, p4est_topidx_t num_corners, const double *vertices, const p4est_topidx_t * ttv, const p4est_topidx_t * ttt, const int8_t * ttf, const p4est_topidx_t * tte, const p4est_topidx_t * eoff, const p4est_topidx_t * ett, const int8_t * ete, const p4est_topidx_t * ttc, const p4est_topidx_t * coff, const p4est_topidx_t * ctt, const int8_t * ctc); ``` """ -function sc_io_write_at(mpifile, offset, ptr, count, t, ocount) - @ccall libsc.sc_io_write_at(mpifile::MPI_File, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::MPI_Datatype, ocount::Ptr{Cint})::Cint +function p8est_connectivity_new_copy(num_vertices, num_trees, num_edges, num_corners, vertices, ttv, ttt, ttf, tte, eoff, ett, ete, ttc, coff, ctt, ctc) + @ccall libt8.p8est_connectivity_new_copy(num_vertices::p4est_topidx_t, num_trees::p4est_topidx_t, num_edges::p4est_topidx_t, num_corners::p4est_topidx_t, vertices::Ptr{Cdouble}, ttv::Ptr{p4est_topidx_t}, ttt::Ptr{p4est_topidx_t}, ttf::Ptr{Int8}, tte::Ptr{p4est_topidx_t}, eoff::Ptr{p4est_topidx_t}, ett::Ptr{p4est_topidx_t}, ete::Ptr{Int8}, ttc::Ptr{p4est_topidx_t}, coff::Ptr{p4est_topidx_t}, ctt::Ptr{p4est_topidx_t}, ctc::Ptr{Int8})::Ptr{p8est_connectivity_t} end """ - sc_io_write_at_all(mpifile, offset, ptr, count, t, ocount) + p8est_connectivity_bcast(conn_in, root, comm) ### Prototype ```c -int sc_io_write_at_all (sc_MPI_File mpifile, sc_MPI_Offset offset, const void *ptr, int count, sc_MPI_Datatype t, int *ocount); +p8est_connectivity_t *p8est_connectivity_bcast (p8est_connectivity_t * conn_in, int root, sc_MPI_Comm comm); ``` """ -function sc_io_write_at_all(mpifile, offset, ptr, count, t, ocount) - @ccall libsc.sc_io_write_at_all(mpifile::MPI_File, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::MPI_Datatype, ocount::Ptr{Cint})::Cint +function p8est_connectivity_bcast(conn_in, root, comm) + @ccall libt8.p8est_connectivity_bcast(conn_in::Ptr{p8est_connectivity_t}, root::Cint, comm::Cint)::Ptr{p8est_connectivity_t} end """ - sc_io_close(file) + p8est_connectivity_destroy(connectivity) + +Destroy a connectivity structure. Also destroy all attributes. ### Prototype ```c -int sc_io_close (sc_MPI_File * file); +void p8est_connectivity_destroy (p8est_connectivity_t * connectivity); ``` """ -function sc_io_close(file) - @ccall libsc.sc_io_close(file::Ptr{Cint})::Cint +function p8est_connectivity_destroy(connectivity) + @ccall libt8.p8est_connectivity_destroy(connectivity::Ptr{p8est_connectivity_t})::Cvoid end """ - p4est_comm_tag - -Tags for MPI messages -""" -@cenum p4est_comm_tag::UInt32 begin - P4EST_COMM_TAG_FIRST = 214 - P4EST_COMM_COUNT_PERTREE = 295 - P4EST_COMM_BALANCE_FIRST_COUNT = 296 - P4EST_COMM_BALANCE_FIRST_LOAD = 297 - P4EST_COMM_BALANCE_SECOND_COUNT = 298 - P4EST_COMM_BALANCE_SECOND_LOAD = 299 - P4EST_COMM_PARTITION_GIVEN = 300 - P4EST_COMM_PARTITION_WEIGHTED_LOW = 301 - P4EST_COMM_PARTITION_WEIGHTED_HIGH = 302 - P4EST_COMM_PARTITION_CORRECTION = 303 - P4EST_COMM_GHOST_COUNT = 304 - P4EST_COMM_GHOST_LOAD = 305 - P4EST_COMM_GHOST_EXCHANGE = 306 - P4EST_COMM_GHOST_EXPAND_COUNT = 307 - P4EST_COMM_GHOST_EXPAND_LOAD = 308 - P4EST_COMM_GHOST_SUPPORT_COUNT = 309 - P4EST_COMM_GHOST_SUPPORT_LOAD = 310 - P4EST_COMM_GHOST_CHECKSUM = 311 - P4EST_COMM_NODES_QUERY = 312 - P4EST_COMM_NODES_REPLY = 313 - P4EST_COMM_SAVE = 314 - P4EST_COMM_LNODES_TEST = 315 - P4EST_COMM_LNODES_PASS = 316 - P4EST_COMM_LNODES_OWNED = 317 - P4EST_COMM_LNODES_ALL = 318 - P4EST_COMM_TAG_LAST = 319 -end - -"""Tags for MPI messages""" -const p4est_comm_tag_t = p4est_comm_tag + p8est_connectivity_set_attr(conn, bytes_per_tree) -""" - p4est_log_indent_push() +Allocate or free the attribute fields in a connectivity. +# Arguments +* `conn`:\\[in,out\\] The conn->*\\_to\\_attr fields must either be NULL or previously be allocated by this function. +* `bytes_per_tree`:\\[in\\] If 0, tree\\_to\\_attr is freed (being NULL is ok). If positive, requested space is allocated. ### Prototype ```c -static inline void p4est_log_indent_push (void); +void p8est_connectivity_set_attr (p8est_connectivity_t * conn, size_t bytes_per_tree); ``` """ -function p4est_log_indent_push() - @ccall libp4est.p4est_log_indent_push()::Cvoid +function p8est_connectivity_set_attr(conn, bytes_per_tree) + @ccall libt8.p8est_connectivity_set_attr(conn::Ptr{p8est_connectivity_t}, bytes_per_tree::Csize_t)::Cvoid end """ - p4est_log_indent_pop() + p8est_connectivity_is_valid(connectivity) + +Examine a connectivity structure. +# Returns +Returns true if structure is valid, false otherwise. ### Prototype ```c -static inline void p4est_log_indent_pop (void); +int p8est_connectivity_is_valid (p8est_connectivity_t * connectivity); ``` """ -function p4est_log_indent_pop() - @ccall libp4est.p4est_log_indent_pop()::Cvoid +function p8est_connectivity_is_valid(connectivity) + @ccall libt8.p8est_connectivity_is_valid(connectivity::Ptr{p8est_connectivity_t})::Cint end """ - p4est_init(log_handler, log_threshold) + p8est_connectivity_is_equal(conn1, conn2) -Registers p4est with the SC Library and sets the logging behavior. This function is optional. This function must only be called before additional threads are created. If this function is not called or called with log\\_handler == NULL, the default SC log handler will be used. If this function is not called or called with log\\_threshold == `SC_LP_DEFAULT`, the default SC log threshold will be used. The default SC log settings can be changed with [`sc_set_log_defaults`](@ref) (). +Check two connectivity structures for equality. +# Returns +Returns true if structures are equal, false otherwise. ### Prototype ```c -void p4est_init (sc_log_handler_t log_handler, int log_threshold); +int p8est_connectivity_is_equal (p8est_connectivity_t * conn1, p8est_connectivity_t * conn2); ``` """ -function p4est_init(log_handler, log_threshold) - @ccall libp4est.p4est_init(log_handler::sc_log_handler_t, log_threshold::Cint)::Cvoid +function p8est_connectivity_is_equal(conn1, conn2) + @ccall libt8.p8est_connectivity_is_equal(conn1::Ptr{p8est_connectivity_t}, conn2::Ptr{p8est_connectivity_t})::Cint end """ - p4est_is_initialized() - -Return whether p4est has been initialized or not. Keep in mind that p4est_init is an optional function but it helps with proper parallel logging. + p8est_connectivity_sink(conn, sink) -Currently there is no inverse to p4est_init, and no way to deinit it. This is ok since initialization generally does no harm. Just do not call libsc's finalize function while p4est is still in use. +Write connectivity to a sink object. +# Arguments +* `conn`:\\[in\\] The connectivity to be written. +* `sink`:\\[in,out\\] The connectivity is written into this sink. # Returns -True if p4est has been initialized with a call to p4est_init and false otherwise. +0 on success, nonzero on error. ### Prototype ```c -int p4est_is_initialized (void); +int p8est_connectivity_sink (p8est_connectivity_t * conn, sc_io_sink_t * sink); ``` """ -function p4est_is_initialized() - @ccall libp4est.p4est_is_initialized()::Cint +function p8est_connectivity_sink(conn, sink) + @ccall libt8.p8est_connectivity_sink(conn::Ptr{p8est_connectivity_t}, sink::Ptr{sc_io_sink_t})::Cint end """ - p4est_have_zlib() + p8est_connectivity_deflate(conn, code) -Check for a sufficiently recent zlib installation. +Allocate memory and store the connectivity information there. +# Arguments +* `conn`:\\[in\\] The connectivity structure to be exported to memory. +* `code`:\\[in\\] Encoding and compression method for serialization. # Returns -True if zlib is detected in both sc and p4est. +Newly created array that contains the information. ### Prototype ```c -int p4est_have_zlib (void); +sc_array_t *p8est_connectivity_deflate (p8est_connectivity_t * conn, p8est_connectivity_encode_t code); ``` """ -function p4est_have_zlib() - @ccall libp4est.p4est_have_zlib()::Cint +function p8est_connectivity_deflate(conn, code) + @ccall libt8.p8est_connectivity_deflate(conn::Ptr{p8est_connectivity_t}, code::p8est_connectivity_encode_t)::Ptr{sc_array_t} end """ - p4est_get_package_id() + p8est_connectivity_save(filename, connectivity) -Query the package identity as registered in libsc. +Save a connectivity structure to disk. +# Arguments +* `filename`:\\[in\\] Name of the file to write. +* `connectivity`:\\[in\\] Valid connectivity structure. # Returns -This is -1 before p4est_init has been called and a proper package identifier (>= 0) afterwards. +Returns 0 on success, nonzero on file error. ### Prototype ```c -int p4est_get_package_id (void); +int p8est_connectivity_save (const char *filename, p8est_connectivity_t * connectivity); ``` """ -function p4est_get_package_id() - @ccall libp4est.p4est_get_package_id()::Cint +function p8est_connectivity_save(filename, connectivity) + @ccall libt8.p8est_connectivity_save(filename::Cstring, connectivity::Ptr{p8est_connectivity_t})::Cint end """ - p4est_topidx_hash2(tt) + p8est_connectivity_source(source) + +Read connectivity from a source object. +# Arguments +* `source`:\\[in,out\\] The connectivity is read from this source. +# Returns +The newly created connectivity, or NULL on error. ### Prototype ```c -static inline unsigned p4est_topidx_hash2 (const p4est_topidx_t * tt); +p8est_connectivity_t *p8est_connectivity_source (sc_io_source_t * source); ``` """ -function p4est_topidx_hash2(tt) - @ccall libp4est.p4est_topidx_hash2(tt::Ptr{p4est_topidx_t})::Cuint +function p8est_connectivity_source(source) + @ccall libt8.p8est_connectivity_source(source::Ptr{sc_io_source_t})::Ptr{p8est_connectivity_t} end """ - p4est_topidx_hash3(tt) + p8est_connectivity_inflate(buffer) + +Create new connectivity from a memory buffer. This function aborts on malloc errors. +# Arguments +* `buffer`:\\[in\\] The connectivity is created from this memory buffer. +# Returns +The newly created connectivity, or NULL on format error of the buffered connectivity data. ### Prototype ```c -static inline unsigned p4est_topidx_hash3 (const p4est_topidx_t * tt); +p8est_connectivity_t *p8est_connectivity_inflate (sc_array_t * buffer); ``` """ -function p4est_topidx_hash3(tt) - @ccall libp4est.p4est_topidx_hash3(tt::Ptr{p4est_topidx_t})::Cuint +function p8est_connectivity_inflate(buffer) + @ccall libt8.p8est_connectivity_inflate(buffer::Ptr{sc_array_t})::Ptr{p8est_connectivity_t} end """ - p4est_topidx_hash4(tt) + p8est_connectivity_load(filename, bytes) + +Load a connectivity structure from disk. +# Arguments +* `filename`:\\[in\\] Name of the file to read. +* `bytes`:\\[out\\] Size in bytes of connectivity on disk or NULL. +# Returns +Returns valid connectivity, or NULL on file error. ### Prototype ```c -static inline unsigned p4est_topidx_hash4 (const p4est_topidx_t * tt); +p8est_connectivity_t *p8est_connectivity_load (const char *filename, size_t *bytes); ``` """ -function p4est_topidx_hash4(tt) - @ccall libp4est.p4est_topidx_hash4(tt::Ptr{p4est_topidx_t})::Cuint +function p8est_connectivity_load(filename, bytes) + @ccall libt8.p8est_connectivity_load(filename::Cstring, bytes::Ptr{Csize_t})::Ptr{p8est_connectivity_t} end """ - p4est_topidx_is_sorted(t, length) + p8est_connectivity_new_unitcube() + +Create a connectivity structure for the unit cube. ### Prototype ```c -static inline int p4est_topidx_is_sorted (p4est_topidx_t * t, int length); +p8est_connectivity_t *p8est_connectivity_new_unitcube (void); ``` """ -function p4est_topidx_is_sorted(t, length) - @ccall libp4est.p4est_topidx_is_sorted(t::Ptr{p4est_topidx_t}, length::Cint)::Cint +function p8est_connectivity_new_unitcube() + @ccall libt8.p8est_connectivity_new_unitcube()::Ptr{p8est_connectivity_t} end """ - p4est_topidx_bsort(t, length) + p8est_connectivity_new_periodic() + +Create a connectivity structure for an all-periodic unit cube. ### Prototype ```c -static inline void p4est_topidx_bsort (p4est_topidx_t * t, int length); +p8est_connectivity_t *p8est_connectivity_new_periodic (void); ``` """ -function p4est_topidx_bsort(t, length) - @ccall libp4est.p4est_topidx_bsort(t::Ptr{p4est_topidx_t}, length::Cint)::Cvoid +function p8est_connectivity_new_periodic() + @ccall libt8.p8est_connectivity_new_periodic()::Ptr{p8est_connectivity_t} end """ - p4est_partition_cut_uint64(global_num, p, num_procs) + p8est_connectivity_new_rotwrap() + +Create a connectivity structure for a mostly periodic unit cube. The left and right faces are identified, and bottom and top rotated. Front and back are not identified. ### Prototype ```c -static inline uint64_t p4est_partition_cut_uint64 (uint64_t global_num, int p, int num_procs); +p8est_connectivity_t *p8est_connectivity_new_rotwrap (void); ``` """ -function p4est_partition_cut_uint64(global_num, p, num_procs) - @ccall libp4est.p4est_partition_cut_uint64(global_num::UInt64, p::Cint, num_procs::Cint)::UInt64 +function p8est_connectivity_new_rotwrap() + @ccall libt8.p8est_connectivity_new_rotwrap()::Ptr{p8est_connectivity_t} end """ - p4est_partition_cut_gloidx(global_num, p, num_procs) + p8est_connectivity_new_drop() + +Create a connectivity structure for a five-trees geometry with a hole. The geometry is a 3D extrusion of the two drop example, and covers [0, 3]*[0, 2]*[0, 3]. The additional dimension is Y. ### Prototype ```c -static inline p4est_gloidx_t p4est_partition_cut_gloidx (p4est_gloidx_t global_num, int p, int num_procs); +p8est_connectivity_t *p8est_connectivity_new_drop (void); ``` """ -function p4est_partition_cut_gloidx(global_num, p, num_procs) - @ccall libp4est.p4est_partition_cut_gloidx(global_num::p4est_gloidx_t, p::Cint, num_procs::Cint)::p4est_gloidx_t +function p8est_connectivity_new_drop() + @ccall libt8.p8est_connectivity_new_drop()::Ptr{p8est_connectivity_t} end """ - p4est_version() + p8est_connectivity_new_twocubes() -Return the full version of p4est. +Create a connectivity structure that contains two cubes. -# Returns -Return the version of p4est using the format `VERSION\\_MAJOR.VERSION\\_MINOR.VERSION\\_POINT`, where `VERSION_POINT` can contain dots and characters, e.g. to indicate the additional number of commits and a git commit hash. ### Prototype ```c -const char *p4est_version (void); +p8est_connectivity_t *p8est_connectivity_new_twocubes (void); ``` """ -function p4est_version() - @ccall libp4est.p4est_version()::Cstring +function p8est_connectivity_new_twocubes() + @ccall libt8.p8est_connectivity_new_twocubes()::Ptr{p8est_connectivity_t} end """ - p4est_version_major() + p8est_connectivity_new_twotrees(l_face, r_face, orientation) -Return the major version of p4est. +Create a connectivity structure for two trees being rotated w.r.t. each other in a user-defined way. -# Returns -Return the major version of p4est. +# Arguments +* `l_face`:\\[in\\] index of left face +* `r_face`:\\[in\\] index of right face +* `orientation`:\\[in\\] orientation of trees w.r.t. each other ### Prototype ```c -int p4est_version_major (void); +p8est_connectivity_t *p8est_connectivity_new_twotrees (int l_face, int r_face, int orientation); ``` """ -function p4est_version_major() - @ccall libp4est.p4est_version_major()::Cint +function p8est_connectivity_new_twotrees(l_face, r_face, orientation) + @ccall libt8.p8est_connectivity_new_twotrees(l_face::Cint, r_face::Cint, orientation::Cint)::Ptr{p8est_connectivity_t} end """ - p4est_version_minor() + p8est_connectivity_new_twowrap() -Return the minor version of p4est. +Create a connectivity structure that contains two cubes where the two far ends are identified periodically. -# Returns -Return the minor version of p4est. ### Prototype ```c -int p4est_version_minor (void); +p8est_connectivity_t *p8est_connectivity_new_twowrap (void); ``` """ -function p4est_version_minor() - @ccall libp4est.p4est_version_minor()::Cint +function p8est_connectivity_new_twowrap() + @ccall libt8.p8est_connectivity_new_twowrap()::Ptr{p8est_connectivity_t} end """ - p4est_connect_type_t - -Characterize a type of adjacency. + p8est_connectivity_new_rotcubes() -Several functions involve relationships between neighboring trees and/or quadrants, and their behavior depends on how one defines adjacency: 1) entities are adjacent if they share a face, or 2) entities are adjacent if they share a face or corner. [`p4est_connect_type_t`](@ref) is used to choose the desired behavior. This enum must fit into an int8\\_t. +Create a connectivity structure that contains a few cubes. These are rotated against each other to stress the topology routines. -| Enumerator | Note | -| :----------------------- | :--------------------------------- | -| P4EST\\_CONNECT\\_SELF | No balance whatsoever. | -| P4EST\\_CONNECT\\_FACE | Balance across faces only. | -| P4EST\\_CONNECT\\_ALMOST | = CORNER - 1. | -| P4EST\\_CONNECT\\_CORNER | Balance across faces and corners. | -| P4EST\\_CONNECT\\_FULL | = CORNER. | +### Prototype +```c +p8est_connectivity_t *p8est_connectivity_new_rotcubes (void); +``` """ -@cenum p4est_connect_type_t::UInt32 begin - P4EST_CONNECT_SELF = 20 - P4EST_CONNECT_FACE = 21 - P4EST_CONNECT_ALMOST = 21 - P4EST_CONNECT_CORNER = 22 - P4EST_CONNECT_FULL = 22 +function p8est_connectivity_new_rotcubes() + @ccall libt8.p8est_connectivity_new_rotcubes()::Ptr{p8est_connectivity_t} end """ - p4est_connectivity_encode_t + p8est_connectivity_new_pillow() -Typedef for serialization method. +Create a connectivity structure for two trees on top of each other. This connectivity is meant to be used with p8est_geometry_new_pillow to map a spherical shell. -| Enumerator | Note | -| :--------------------------- | :-------------------------------- | -| P4EST\\_CONN\\_ENCODE\\_LAST | Invalid entry to close the list. | +### Prototype +```c +p8est_connectivity_t *p8est_connectivity_new_pillow (void); +``` """ -@cenum p4est_connectivity_encode_t::UInt32 begin - P4EST_CONN_ENCODE_NONE = 0 - P4EST_CONN_ENCODE_LAST = 1 +function p8est_connectivity_new_pillow() + @ccall libt8.p8est_connectivity_new_pillow()::Ptr{p8est_connectivity_t} end """ - p4est_connect_type_int(btype) + p8est_connectivity_new_brick(m, n, p, periodic_a, periodic_b, periodic_c) -Convert the [`p4est_connect_type_t`](@ref) into a number. +An m by n by p array with periodicity in x, y, and z if periodic\\_a, periodic\\_b, and periodic\\_c are true, respectively. -# Arguments -* `btype`:\\[in\\] The balance type to convert. -# Returns -Returns 1 or 2. ### Prototype ```c -int p4est_connect_type_int (p4est_connect_type_t btype); +p8est_connectivity_t *p8est_connectivity_new_brick (int m, int n, int p, int periodic_a, int periodic_b, int periodic_c); ``` """ -function p4est_connect_type_int(btype) - @ccall libp4est.p4est_connect_type_int(btype::p4est_connect_type_t)::Cint +function p8est_connectivity_new_brick(m, n, p, periodic_a, periodic_b, periodic_c) + @ccall libt8.p8est_connectivity_new_brick(m::Cint, n::Cint, p::Cint, periodic_a::Cint, periodic_b::Cint, periodic_c::Cint)::Ptr{p8est_connectivity_t} end """ - p4est_connect_type_string(btype) + p8est_connectivity_new_shell() -Convert the [`p4est_connect_type_t`](@ref) into a const string. +Create a connectivity structure that builds a spherical shell. It is made up of six connected parts [-1,1]x[-1,1]x[1,2]. This connectivity reuses vertices and relies on a geometry transformation. It is thus not suitable for [`p8est_connectivity_complete`](@ref). -# Arguments -* `btype`:\\[in\\] The balance type to convert. -# Returns -Returns a pointer to a constant string. ### Prototype ```c -const char *p4est_connect_type_string (p4est_connect_type_t btype); +p8est_connectivity_t *p8est_connectivity_new_shell (void); ``` """ -function p4est_connect_type_string(btype) - @ccall libp4est.p4est_connect_type_string(btype::p4est_connect_type_t)::Cstring +function p8est_connectivity_new_shell() + @ccall libt8.p8est_connectivity_new_shell()::Ptr{p8est_connectivity_t} end """ - p4est_connectivity - -This structure holds the 2D inter-tree connectivity information. Identification of arbitrary faces and corners is possible. - -The arrays tree\\_to\\_* are stored in z ordering. For corners the order wrt. yx is 00 01 10 11. For faces the order is given by the normal directions -x +x -y +y. Each face has a natural direction by increasing face corner number. Face connections are allocated [0][0]..[0][3]..[num\\_trees-1][0]..[num\\_trees-1][3]. If a face is on the physical boundary it must connect to itself. - -The values for tree\\_to\\_face are 0..7 where ttf % 4 gives the face number and ttf / 4 the face orientation code. The orientation is 0 for faces that are mutually direction-aligned and 1 for faces that are running in opposite directions. - -It is valid to specify num\\_vertices as 0. In this case vertices and tree\\_to\\_vertex are set to NULL. Otherwise the vertex coordinates are stored in the array vertices as [0][0]..[0][2]..[num\\_vertices-1][0]..[num\\_vertices-1][2]. Vertex coordinates are optional and not used for inferring topology. - -The corners are stored when they connect trees that are not already face neighbors at that specific corner. In this case tree\\_to\\_corner indexes into *ctt_offset*. Otherwise the tree\\_to\\_corner entry must be -1 and this corner is ignored. If num\\_corners == 0, tree\\_to\\_corner and corner\\_to\\_* arrays are set to NULL. - -The arrays corner\\_to\\_* store a variable number of entries per corner. For corner c these are at position [ctt\\_offset[c]]..[ctt\\_offset[c+1]-1]. Their number for corner c is ctt\\_offset[c+1] - ctt\\_offset[c]. The entries encode all trees adjacent to corner c. The size of the corner\\_to\\_* arrays is num\\_ctt = ctt\\_offset[num\\_corners]. - -The *\\_to\\_attr arrays may have arbitrary contents defined by the user. We do not interpret them. - -!!! note + p8est_connectivity_new_sphere() - If a connectivity implies natural connections between trees that are corner neighbors without being face neighbors, these corners shall be encoded explicitly in the connectivity. +Create a connectivity structure that builds a solid sphere. It is made up of two layers and a cube in the center. This connectivity reuses vertices and relies on a geometry transformation. It is thus not suitable for [`p8est_connectivity_complete`](@ref). -| Field | Note | -| :------------------- | :----------------------------------------------------------------------------------- | -| num\\_vertices | the number of vertices that define the *embedding* of the forest (not the topology) | -| num\\_trees | the number of trees | -| num\\_corners | the number of corners that help define topology | -| vertices | an array of size (3 * *num_vertices*) | -| tree\\_to\\_vertex | embed each tree into ```c++ R^3 ``` for e.g. visualization (see p4est\\_vtk.h) | -| tree\\_attr\\_bytes | bytes per tree in tree\\_to\\_attr | -| tree\\_to\\_attr | not touched by p4est | -| tree\\_to\\_tree | (4 * *num_trees*) neighbors across faces | -| tree\\_to\\_face | (4 * *num_trees*) face to face+orientation (see description) | -| tree\\_to\\_corner | (4 * *num_trees*) or NULL (see description) | -| ctt\\_offset | corner to offset in *corner_to_tree* and *corner_to_corner* | -| corner\\_to\\_tree | list of trees that meet at a corner | -| corner\\_to\\_corner | list of tree-corners that meet at a corner | +### Prototype +```c +p8est_connectivity_t *p8est_connectivity_new_sphere (void); +``` """ -struct p4est_connectivity - num_vertices::p4est_topidx_t - num_trees::p4est_topidx_t - num_corners::p4est_topidx_t - vertices::Ptr{Cdouble} - tree_to_vertex::Ptr{p4est_topidx_t} - tree_attr_bytes::Csize_t - tree_to_attr::Cstring - tree_to_tree::Ptr{p4est_topidx_t} - tree_to_face::Ptr{Int8} - tree_to_corner::Ptr{p4est_topidx_t} - ctt_offset::Ptr{p4est_topidx_t} - corner_to_tree::Ptr{p4est_topidx_t} - corner_to_corner::Ptr{Int8} +function p8est_connectivity_new_sphere() + @ccall libt8.p8est_connectivity_new_sphere()::Ptr{p8est_connectivity_t} end """ -This structure holds the 2D inter-tree connectivity information. Identification of arbitrary faces and corners is possible. - -The arrays tree\\_to\\_* are stored in z ordering. For corners the order wrt. yx is 00 01 10 11. For faces the order is given by the normal directions -x +x -y +y. Each face has a natural direction by increasing face corner number. Face connections are allocated [0][0]..[0][3]..[num\\_trees-1][0]..[num\\_trees-1][3]. If a face is on the physical boundary it must connect to itself. - -The values for tree\\_to\\_face are 0..7 where ttf % 4 gives the face number and ttf / 4 the face orientation code. The orientation is 0 for faces that are mutually direction-aligned and 1 for faces that are running in opposite directions. - -It is valid to specify num\\_vertices as 0. In this case vertices and tree\\_to\\_vertex are set to NULL. Otherwise the vertex coordinates are stored in the array vertices as [0][0]..[0][2]..[num\\_vertices-1][0]..[num\\_vertices-1][2]. Vertex coordinates are optional and not used for inferring topology. + p8est_connectivity_new_torus(nSegments) -The corners are stored when they connect trees that are not already face neighbors at that specific corner. In this case tree\\_to\\_corner indexes into *ctt_offset*. Otherwise the tree\\_to\\_corner entry must be -1 and this corner is ignored. If num\\_corners == 0, tree\\_to\\_corner and corner\\_to\\_* arrays are set to NULL. +Create a connectivity structure that builds a revolution torus. -The arrays corner\\_to\\_* store a variable number of entries per corner. For corner c these are at position [ctt\\_offset[c]]..[ctt\\_offset[c+1]-1]. Their number for corner c is ctt\\_offset[c+1] - ctt\\_offset[c]. The entries encode all trees adjacent to corner c. The size of the corner\\_to\\_* arrays is num\\_ctt = ctt\\_offset[num\\_corners]. +This connectivity reuses vertices and relies on a geometry transformation. It is thus not suitable for [`p8est_connectivity_complete`](@ref). -The *\\_to\\_attr arrays may have arbitrary contents defined by the user. We do not interpret them. +This connectivity reuses ideas from disk2d connectivity. More precisely the torus is divided into segments around the revolution axis, each segments is made of 5 trees (Ă  la disk2d). The total number of trees if 5 times the number of segments. -!!! note +This connectivity is meant to be used with p8est_geometry_new_torus - If a connectivity implies natural connections between trees that are corner neighbors without being face neighbors, these corners shall be encoded explicitly in the connectivity. +# Arguments +* `nSegments`:\\[in\\] number of trees along the great circle +### Prototype +```c +p8est_connectivity_t *p8est_connectivity_new_torus (int nSegments); +``` """ -const p4est_connectivity_t = p4est_connectivity +function p8est_connectivity_new_torus(nSegments) + @ccall libt8.p8est_connectivity_new_torus(nSegments::Cint)::Ptr{p8est_connectivity_t} +end """ - p4est_connectivity_memory_used(conn) + p8est_connectivity_new_byname(name) -Calculate memory usage of a connectivity structure. +Create connectivity structure from predefined catalogue. # Arguments -* `conn`:\\[in\\] Connectivity structure. +* `name`:\\[in\\] Invokes connectivity\\_new\\_* function. brick235 brick (2, 3, 5, 0, 0, 0) periodic periodic rotcubes rotcubes rotwrap rotwrap shell shell sphere sphere twocubes twocubes twowrap twowrap unit unitcube # Returns -Memory used in bytes. +An initialized connectivity if name is defined, NULL else. ### Prototype ```c -size_t p4est_connectivity_memory_used (p4est_connectivity_t * conn); +p8est_connectivity_t *p8est_connectivity_new_byname (const char *name); ``` """ -function p4est_connectivity_memory_used(conn) - @ccall libp4est.p4est_connectivity_memory_used(conn::Ptr{p4est_connectivity_t})::Csize_t +function p8est_connectivity_new_byname(name) + @ccall libt8.p8est_connectivity_new_byname(name::Cstring)::Ptr{p8est_connectivity_t} end """ - p4est_corner_transform_t + p8est_connectivity_refine(conn, num_per_dim) -Generic interface for transformations between a tree and any of its corner +Uniformly refine a connectivity. This is useful if you would like to uniformly refine by something other than a power of 2. -| Field | Note | -| :------ | :------------------------ | -| ntree | The number of the tree | -| ncorner | The number of the corner | +# Arguments +* `conn`:\\[in\\] A valid connectivity +* `num_per_dim`:\\[in\\] The number of new trees in each direction. Must use no more than P8EST_OLD_QMAXLEVEL bits. +# Returns +a refined connectivity. +### Prototype +```c +p8est_connectivity_t *p8est_connectivity_refine (p8est_connectivity_t * conn, int num_per_dim); +``` """ -struct p4est_corner_transform_t - ntree::p4est_topidx_t - ncorner::Int8 +function p8est_connectivity_refine(conn, num_per_dim) + @ccall libt8.p8est_connectivity_refine(conn::Ptr{p8est_connectivity_t}, num_per_dim::Cint)::Ptr{p8est_connectivity_t} end """ - p4est_corner_info_t + p8est_expand_face_transform(iface, nface, ftransform) -Information about the neighbors of a corner +Fill an array with the axis combination of a face neighbor transform. -| Field | Note | -| :------------------ | :------------------------------------------------ | -| icorner | The number of the originating corner | -| corner\\_transforms | The array of neighbors of the originating corner | +# Arguments +* `iface`:\\[in\\] The number of the originating face. +* `nface`:\\[in\\] Encoded as nface = r * 6 + nf, where nf = 0..5 is the neigbbor's connecting face number and r = 0..3 is the relative orientation to the neighbor's face. This encoding matches [`p8est_connectivity_t`](@ref). +* `ftransform`:\\[out\\] This array holds 9 integers. [0]..[2] The coordinate axis sequence of the origin face, the first two referring to the tangentials and the third to the normal. A permutation of (0, 1, 2). [3]..[5] The coordinate axis sequence of the target face. [6]..[8] Edge reversal flags for tangential axes (boolean); face code in [0, 3] for the normal coordinate q: 0: q' = -q 1: q' = q + 1 2: q' = q - 1 3: q' = 2 - q +### Prototype +```c +void p8est_expand_face_transform (int iface, int nface, int ftransform[]); +``` """ -struct p4est_corner_info_t - icorner::p4est_topidx_t - corner_transforms::sc_array_t +function p8est_expand_face_transform(iface, nface, ftransform) + @ccall libt8.p8est_expand_face_transform(iface::Cint, nface::Cint, ftransform::Ptr{Cint})::Cvoid end """ - p4est_neighbor_transform_t + p8est_find_face_transform(connectivity, itree, iface, ftransform) -Generic interface for transformations between a tree and any of its neighbors +Fill an array with the axis combination of a face neighbor transform. -| Field | Note | -| :---------------- | :-------------------------------------------------------------------------- | -| neighbor\\_type | type of connection to neighbor | -| neighbor | neighbor tree index | -| index\\_self | index of interface from self's perspective | -| index\\_neighbor | index of interface from neighbor's perspective | -| perm | permutation of dimensions when transforming self coords to neighbor coords | -| sign | sign changes when transforming self coords to neighbor coords | -| origin\\_self | point on the interface from self's perspective | -| origin\\_neighbor | point on the interface from neighbor's perspective | +# Arguments +* `connectivity`:\\[in\\] Connectivity structure. +* `itree`:\\[in\\] The number of the originating tree. +* `iface`:\\[in\\] The number of the originating tree's face. +* `ftransform`:\\[out\\] This array holds 9 integers. [0]..[2] The coordinate axis sequence of the origin face. [3]..[5] The coordinate axis sequence of the target face. [6]..[8] Edge reversal flag for axes t1, t2; face code for n; +# Returns +The face neighbor tree if it exists, -1 otherwise. +# See also +[`p8est_expand_face_transform`](@ref). + +### Prototype +```c +p4est_topidx_t p8est_find_face_transform (p8est_connectivity_t * connectivity, p4est_topidx_t itree, int iface, int ftransform[]); +``` """ -struct p4est_neighbor_transform_t - neighbor_type::p4est_connect_type_t - neighbor::p4est_topidx_t - index_self::Int8 - index_neighbor::Int8 - perm::NTuple{2, Int8} - sign::NTuple{2, Int8} - origin_self::NTuple{2, p4est_qcoord_t} - origin_neighbor::NTuple{2, p4est_qcoord_t} +function p8est_find_face_transform(connectivity, itree, iface, ftransform) + @ccall libt8.p8est_find_face_transform(connectivity::Ptr{p8est_connectivity_t}, itree::p4est_topidx_t, iface::Cint, ftransform::Ptr{Cint})::p4est_topidx_t end """ - p4est_neighbor_transform_coordinates(nt, self_coords, neigh_coords) + p8est_find_edge_transform(connectivity, itree, iedge, ei) -Transform from self's coordinate system to neighbor's coordinate system. +Fills an array with information about edge neighbors. # Arguments -* `nt`:\\[in\\] A neighbor transform. -* `self_coords`:\\[in\\] Input quadrant coordinates in self coordinates. -* `neigh_coords`:\\[out\\] Coordinates transformed into neighbor coordinates. +* `connectivity`:\\[in\\] Connectivity structure. +* `itree`:\\[in\\] The number of the originating tree. +* `iedge`:\\[in\\] The number of the originating edge. +* `ei`:\\[in,out\\] A [`p8est_edge_info_t`](@ref) structure with initialized array. ### Prototype ```c -void p4est_neighbor_transform_coordinates (const p4est_neighbor_transform_t * nt, const p4est_qcoord_t self_coords[P4EST_DIM], p4est_qcoord_t neigh_coords[P4EST_DIM]); +void p8est_find_edge_transform (p8est_connectivity_t * connectivity, p4est_topidx_t itree, int iedge, p8est_edge_info_t * ei); ``` """ -function p4est_neighbor_transform_coordinates(nt, self_coords, neigh_coords) - @ccall libp4est.p4est_neighbor_transform_coordinates(nt::Ptr{p4est_neighbor_transform_t}, self_coords::Ptr{p4est_qcoord_t}, neigh_coords::Ptr{p4est_qcoord_t})::Cvoid +function p8est_find_edge_transform(connectivity, itree, iedge, ei) + @ccall libt8.p8est_find_edge_transform(connectivity::Ptr{p8est_connectivity_t}, itree::p4est_topidx_t, iedge::Cint, ei::Ptr{p8est_edge_info_t})::Cvoid end """ - p4est_neighbor_transform_coordinates_reverse(nt, neigh_coords, self_coords) + p8est_find_corner_transform(connectivity, itree, icorner, ci) -Transform from neighbor's coordinate system to self's coordinate system. +Fills an array with information about corner neighbors. # Arguments -* `nt`:\\[in\\] A neighbor transform. -* `neigh_coords`:\\[in\\] Input quadrant coordinates in self coordinates. -* `self_coords`:\\[out\\] Coordinates transformed into neighbor coordinates. +* `connectivity`:\\[in\\] Connectivity structure. +* `itree`:\\[in\\] The number of the originating tree. +* `icorner`:\\[in\\] The number of the originating corner. +* `ci`:\\[in,out\\] A [`p8est_corner_info_t`](@ref) structure with initialized array. ### Prototype ```c -void p4est_neighbor_transform_coordinates_reverse (const p4est_neighbor_transform_t * nt, const p4est_qcoord_t neigh_coords[P4EST_DIM], p4est_qcoord_t self_coords[P4EST_DIM]); +void p8est_find_corner_transform (p8est_connectivity_t * connectivity, p4est_topidx_t itree, int icorner, p8est_corner_info_t * ci); ``` """ -function p4est_neighbor_transform_coordinates_reverse(nt, neigh_coords, self_coords) - @ccall libp4est.p4est_neighbor_transform_coordinates_reverse(nt::Ptr{p4est_neighbor_transform_t}, neigh_coords::Ptr{p4est_qcoord_t}, self_coords::Ptr{p4est_qcoord_t})::Cvoid +function p8est_find_corner_transform(connectivity, itree, icorner, ci) + @ccall libt8.p8est_find_corner_transform(connectivity::Ptr{p8est_connectivity_t}, itree::p4est_topidx_t, icorner::Cint, ci::Ptr{p8est_corner_info_t})::Cvoid end """ - p4est_connectivity_get_neighbor_transforms(conn, tree_id, boundary_type, boundary_index, neighbor_transform_array) + p8est_connectivity_complete(conn) -Fill an array with the neighbor transforms based on a specific boundary type. This function generalizes all other inter-tree transformation objects +Internally connect a connectivity based on tree\\_to\\_vertex information. Periodicity that is not inherent in the list of vertices will be lost. # Arguments -* `conn`:\\[in\\] Connectivity structure. -* `tree_id`:\\[in\\] The number of the tree. -* `boundary_type`:\\[in\\] The type of the boundary connection (self, face, corner). -* `boundary_index`:\\[in\\] The index of the boundary. -* `neighbor_transform_array`:\\[in,out\\] Array of the neighbor transforms. +* `conn`:\\[in,out\\] The connectivity needs to have proper vertices and tree\\_to\\_vertex fields. The tree\\_to\\_tree and tree\\_to\\_face fields must be allocated and satisfy [`p8est_connectivity_is_valid`](@ref) (conn) but will be overwritten. The edge and corner fields will be freed and allocated anew. ### Prototype ```c -void p4est_connectivity_get_neighbor_transforms (p4est_connectivity_t *conn, p4est_topidx_t tree_id, p4est_connect_type_t boundary_type, int boundary_index, sc_array_t *neighbor_transform_array); +void p8est_connectivity_complete (p8est_connectivity_t * conn); ``` """ -function p4est_connectivity_get_neighbor_transforms(conn, tree_id, boundary_type, boundary_index, neighbor_transform_array) - @ccall libp4est.p4est_connectivity_get_neighbor_transforms(conn::Ptr{p4est_connectivity_t}, tree_id::p4est_topidx_t, boundary_type::p4est_connect_type_t, boundary_index::Cint, neighbor_transform_array::Ptr{sc_array_t})::Cvoid +function p8est_connectivity_complete(conn) + @ccall libt8.p8est_connectivity_complete(conn::Ptr{p8est_connectivity_t})::Cvoid end """ - p4est_connectivity_face_neighbor_face_corner(fc, f, nf, o) + p8est_connectivity_reduce(conn) -Transform a face corner across one of the adjacent faces into a neighbor tree. This version expects the neighbor face and orientation separately. +Removes corner and edge information of a connectivity such that enough information is left to run [`p8est_connectivity_complete`](@ref) successfully. The reduced connectivity still passes [`p8est_connectivity_is_valid`](@ref). # Arguments -* `fc`:\\[in\\] A face corner number in 0..1. -* `f`:\\[in\\] A face that the face corner number *fc* is relative to. -* `nf`:\\[in\\] A neighbor face that is on the other side of *f*. -* `o`:\\[in\\] The orientation between tree boundary faces *f* and *nf*. -# Returns -The face corner number relative to the neighbor's face. +* `conn`:\\[in,out\\] The connectivity to be reduced. ### Prototype ```c -int p4est_connectivity_face_neighbor_face_corner (int fc, int f, int nf, int o); +void p8est_connectivity_reduce (p8est_connectivity_t * conn); ``` """ -function p4est_connectivity_face_neighbor_face_corner(fc, f, nf, o) - @ccall libp4est.p4est_connectivity_face_neighbor_face_corner(fc::Cint, f::Cint, nf::Cint, o::Cint)::Cint +function p8est_connectivity_reduce(conn) + @ccall libt8.p8est_connectivity_reduce(conn::Ptr{p8est_connectivity_t})::Cvoid end """ - p4est_connectivity_face_neighbor_corner(c, f, nf, o) + p8est_connectivity_permute(conn, perm, is_current_to_new) -Transform a corner across one of the adjacent faces into a neighbor tree. This version expects the neighbor face and orientation separately. +[`p8est_connectivity_permute`](@ref) Given a permutation *perm* of the trees in a connectivity *conn*, permute the trees of *conn* in place and update *conn* to match. # Arguments -* `c`:\\[in\\] A corner number in 0..3. -* `f`:\\[in\\] A face number that touches the corner *c*. -* `nf`:\\[in\\] A neighbor face that is on the other side of *f*. -* `o`:\\[in\\] The orientation between tree boundary faces *f* and *nf*. -# Returns -The number of the corner seen from the neighbor tree. +* `conn`:\\[in,out\\] The connectivity whose trees are permuted. +* `perm`:\\[in\\] A permutation array, whose elements are size\\_t's. +* `is_current_to_new`:\\[in\\] if true, the jth entry of perm is the new index for the entry whose current index is j, otherwise the jth entry of perm is the current index of the tree whose index will be j after the permutation. ### Prototype ```c -int p4est_connectivity_face_neighbor_corner (int c, int f, int nf, int o); +void p8est_connectivity_permute (p8est_connectivity_t * conn, sc_array_t * perm, int is_current_to_new); ``` """ -function p4est_connectivity_face_neighbor_corner(c, f, nf, o) - @ccall libp4est.p4est_connectivity_face_neighbor_corner(c::Cint, f::Cint, nf::Cint, o::Cint)::Cint +function p8est_connectivity_permute(conn, perm, is_current_to_new) + @ccall libt8.p8est_connectivity_permute(conn::Ptr{p8est_connectivity_t}, perm::Ptr{sc_array_t}, is_current_to_new::Cint)::Cvoid end """ - p4est_connectivity_new(num_vertices, num_trees, num_corners, num_ctt) + p8est_connectivity_join_faces(conn, tree_left, tree_right, face_left, face_right, orientation) -Allocate a connectivity structure. The attribute fields are initialized to NULL. +[`p8est_connectivity_join_faces`](@ref) This function takes an existing valid connectivity *conn* and modifies it by joining two tree faces that are currently boundary faces. # Arguments -* `num_vertices`:\\[in\\] Number of total vertices (i.e. geometric points). -* `num_trees`:\\[in\\] Number of trees in the forest. -* `num_corners`:\\[in\\] Number of tree-connecting corners. -* `num_ctt`:\\[in\\] Number of total trees in corner\\_to\\_tree array. -# Returns -A connectivity structure with allocated arrays. +* `conn`:\\[in,out\\] connectivity that will be altered. +* `tree_left`:\\[in\\] tree that will be on the left side of the joined faces. +* `tree_right`:\\[in\\] tree that will be on the right side of the joined faces. +* `face_left`:\\[in\\] face of *tree_left* that will be joined. +* `face_right`:\\[in\\] face of *tree_right* that will be joined. +* `orientation`:\\[in\\] the orientation of *face_left* and *face_right* once joined (see the description of [`p8est_connectivity_t`](@ref) to understand orientation). ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new (p4est_topidx_t num_vertices, p4est_topidx_t num_trees, p4est_topidx_t num_corners, p4est_topidx_t num_ctt); +void p8est_connectivity_join_faces (p8est_connectivity_t * conn, p4est_topidx_t tree_left, p4est_topidx_t tree_right, int face_left, int face_right, int orientation); ``` """ -function p4est_connectivity_new(num_vertices, num_trees, num_corners, num_ctt) - @ccall libp4est.p4est_connectivity_new(num_vertices::p4est_topidx_t, num_trees::p4est_topidx_t, num_corners::p4est_topidx_t, num_ctt::p4est_topidx_t)::Ptr{p4est_connectivity_t} +function p8est_connectivity_join_faces(conn, tree_left, tree_right, face_left, face_right, orientation) + @ccall libt8.p8est_connectivity_join_faces(conn::Ptr{p8est_connectivity_t}, tree_left::p4est_topidx_t, tree_right::p4est_topidx_t, face_left::Cint, face_right::Cint, orientation::Cint)::Cvoid end """ - p4est_connectivity_new_copy(num_vertices, num_trees, num_corners, vertices, ttv, ttt, ttf, ttc, coff, ctt, ctc) + p8est_connectivity_is_equivalent(conn1, conn2) -Allocate a connectivity structure and populate from constants. The attribute fields are initialized to NULL. +[`p8est_connectivity_is_equivalent`](@ref) This function compares two connectivities for equivalence: it returns *true* if they are the same connectivity, or if they have the same topology. The definition of topological sameness is strict: there is no attempt made to determine whether permutation and/or rotation of the trees makes the connectivities equivalent. # Arguments -* `num_vertices`:\\[in\\] Number of total vertices (i.e. geometric points). -* `num_trees`:\\[in\\] Number of trees in the forest. -* `num_corners`:\\[in\\] Number of tree-connecting corners. -* `vertices`:\\[in\\] Coordinates of the vertices of the trees. -* `ttv`:\\[in\\] The tree-to-vertex array. -* `ttt`:\\[in\\] The tree-to-tree array. -* `ttf`:\\[in\\] The tree-to-face array (int8\\_t). -* `ttc`:\\[in\\] The tree-to-corner array. -* `coff`:\\[in\\] Corner-to-tree offsets (num\\_corners + 1 values). This must always be non-NULL; in trivial cases it is just a pointer to a p4est\\_topix value of 0. -* `ctt`:\\[in\\] The corner-to-tree array. -* `ctc`:\\[in\\] The corner-to-corner array. -# Returns -The connectivity is checked for validity. +* `conn1`:\\[in\\] a valid connectivity +* `conn2`:\\[out\\] a valid connectivity ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_copy (p4est_topidx_t num_vertices, p4est_topidx_t num_trees, p4est_topidx_t num_corners, const double *vertices, const p4est_topidx_t * ttv, const p4est_topidx_t * ttt, const int8_t * ttf, const p4est_topidx_t * ttc, const p4est_topidx_t * coff, const p4est_topidx_t * ctt, const int8_t * ctc); +int p8est_connectivity_is_equivalent (p8est_connectivity_t * conn1, p8est_connectivity_t * conn2); ``` """ -function p4est_connectivity_new_copy(num_vertices, num_trees, num_corners, vertices, ttv, ttt, ttf, ttc, coff, ctt, ctc) - @ccall libp4est.p4est_connectivity_new_copy(num_vertices::p4est_topidx_t, num_trees::p4est_topidx_t, num_corners::p4est_topidx_t, vertices::Ptr{Cdouble}, ttv::Ptr{p4est_topidx_t}, ttt::Ptr{p4est_topidx_t}, ttf::Ptr{Int8}, ttc::Ptr{p4est_topidx_t}, coff::Ptr{p4est_topidx_t}, ctt::Ptr{p4est_topidx_t}, ctc::Ptr{Int8})::Ptr{p4est_connectivity_t} +function p8est_connectivity_is_equivalent(conn1, conn2) + @ccall libt8.p8est_connectivity_is_equivalent(conn1::Ptr{p8est_connectivity_t}, conn2::Ptr{p8est_connectivity_t})::Cint end """ - p4est_connectivity_bcast(conn_in, root, comm) + p8est_edge_array_index(array, it) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_bcast (p4est_connectivity_t * conn_in, int root, sc_MPI_Comm comm); +static inline p8est_edge_transform_t * p8est_edge_array_index (sc_array_t *array, size_t it); ``` """ -function p4est_connectivity_bcast(conn_in, root, comm) - @ccall libp4est.p4est_connectivity_bcast(conn_in::Ptr{p4est_connectivity_t}, root::Cint, comm::MPI_Comm)::Ptr{p4est_connectivity_t} +function p8est_edge_array_index(array, it) + @ccall libt8.p8est_edge_array_index(array::Ptr{sc_array_t}, it::Csize_t)::Ptr{p8est_edge_transform_t} end """ - p4est_connectivity_destroy(connectivity) - -Destroy a connectivity structure. Also destroy all attributes. + p8est_corner_array_index(array, it) ### Prototype ```c -void p4est_connectivity_destroy (p4est_connectivity_t * connectivity); +static inline p8est_corner_transform_t * p8est_corner_array_index (sc_array_t *array, size_t it); ``` """ -function p4est_connectivity_destroy(connectivity) - @ccall libp4est.p4est_connectivity_destroy(connectivity::Ptr{p4est_connectivity_t})::Cvoid +function p8est_corner_array_index(array, it) + @ccall libt8.p8est_corner_array_index(array::Ptr{sc_array_t}, it::Csize_t)::Ptr{p8est_corner_transform_t} end """ - p4est_connectivity_set_attr(conn, bytes_per_tree) + p8est_connectivity_read_inp_stream(stream, num_vertices, num_trees, vertices, tree_to_vertex) -Allocate or free the attribute fields in a connectivity. +Read an ABAQUS input file from a file stream. + +This utility function reads a basic ABAQUS file supporting element type with the prefix C2D4, CPS4, and S4 in 2D and of type C3D8 reading them as bilinear quadrilateral and trilinear hexahedral trees respectively. + +A basic 2D mesh is given below. The `*Node` section gives the vertex number and x, y, and z components for each vertex. The `*Element` section gives the 4 vertices in 2D (8 vertices in 3D) of each element in counter clockwise order. So in 2D the nodes are given as: + +4 3 +-------------------+ | | | | | | | | | | | | +-------------------+ 1 2 + +and in 3D they are given as: + +8 7 +---------------------+ |\\ |\\ | \\ | \\ | \\ | \\ | \\ | \\ | 5+---------------------+6 | | | | +----|----------------+ | 4\\ | 3 \\ | \\ | \\ | \\ | \\ | \\| \\| +---------------------+ 1 2 + +```c++ + *Heading + box.inp + *Node + 1, 5, -5, 5 + 2, 5, 5, 5 + 3, 5, 0, 5 + 4, -5, 5, 5 + 5, 0, 5, 5 + 6, -5, -5, 5 + 7, -5, 0, 5 + 8, 0, -5, 5 + 9, 0, 0, 5 + 10, 5, 5, -5 + 11, 5, -5, -5 + 12, 5, 0, -5 + 13, -5, -5, -5 + 14, 0, -5, -5 + 15, -5, 5, -5 + 16, -5, 0, -5 + 17, 0, 5, -5 + 18, 0, 0, -5 + 19, -5, -5, 0 + 20, 5, -5, 0 + 21, 0, -5, 0 + 22, -5, 5, 0 + 23, -5, 0, 0 + 24, 5, 5, 0 + 25, 0, 5, 0 + 26, 5, 0, 0 + 27, 0, 0, 0 + *Element, type=C3D8, ELSET=EB1 + 1, 6, 19, 23, 7, 8, 21, 27, 9 + 2, 19, 13, 16, 23, 21, 14, 18, 27 + 3, 7, 23, 22, 4, 9, 27, 25, 5 + 4, 23, 16, 15, 22, 27, 18, 17, 25 + 5, 8, 21, 27, 9, 1, 20, 26, 3 + 6, 21, 14, 18, 27, 20, 11, 12, 26 + 7, 9, 27, 25, 5, 3, 26, 24, 2 + 8, 27, 18, 17, 25, 26, 12, 10, 24 +``` + +This code can be called two ways. The first, when `vertex`==NULL and `tree_to_vertex`==NULL, is used to count the number of trees and vertices in the connectivity to be generated by the `.inp` mesh in the *stream*. The second, when `vertices`!=NULL and `tree_to_vertex`!=NULL, fill `vertices` and `tree_to_vertex`. In this case `num_vertices` and `num_trees` need to be set to the maximum number of entries allocated in `vertices` and `tree_to_vertex`. # Arguments -* `conn`:\\[in,out\\] The conn->*\\_to\\_attr fields must either be NULL or previously be allocated by this function. -* `bytes_per_tree`:\\[in\\] If 0, tree\\_to\\_attr is freed (being NULL is ok). If positive, requested space is allocated. +* `stream`:\\[in,out\\] file stream to read the connectivity from +* `num_vertices`:\\[in,out\\] the number of vertices in the connectivity +* `num_trees`:\\[in,out\\] the number of trees in the connectivity +* `vertices`:\\[out\\] the list of `vertices` of the connectivity +* `tree_to_vertex`:\\[out\\] the `tree_to_vertex` map of the connectivity +# Returns +0 if successful and nonzero if not ### Prototype ```c -void p4est_connectivity_set_attr (p4est_connectivity_t * conn, size_t bytes_per_tree); +int p8est_connectivity_read_inp_stream (FILE * stream, p4est_topidx_t * num_vertices, p4est_topidx_t * num_trees, double *vertices, p4est_topidx_t * tree_to_vertex); ``` """ -function p4est_connectivity_set_attr(conn, bytes_per_tree) - @ccall libp4est.p4est_connectivity_set_attr(conn::Ptr{p4est_connectivity_t}, bytes_per_tree::Csize_t)::Cvoid +function p8est_connectivity_read_inp_stream(stream, num_vertices, num_trees, vertices, tree_to_vertex) + @ccall libt8.p8est_connectivity_read_inp_stream(stream::Ptr{Libc.FILE}, num_vertices::Ptr{p4est_topidx_t}, num_trees::Ptr{p4est_topidx_t}, vertices::Ptr{Cdouble}, tree_to_vertex::Ptr{p4est_topidx_t})::Cint end """ - p4est_connectivity_is_valid(connectivity) + p8est_connectivity_read_inp(filename) -Examine a connectivity structure. +Create a p4est connectivity from an ABAQUS input file. + +This utility function reads a basic ABAQUS file supporting element type with the prefix C2D4, CPS4, and S4 in 2D and of type C3D8 reading them as bilinear quadrilateral and trilinear hexahedral trees respectively. + +A basic 2D mesh is given below. The `*Node` section gives the vertex number and x, y, and z components for each vertex. The `*Element` section gives the 4 vertices in 2D (8 vertices in 3D) of each element in counter clockwise order. So in 2D the nodes are given as: + +4 3 +-------------------+ | | | | | | | | | | | | +-------------------+ 1 2 + +and in 3D they are given as: + +8 7 +---------------------+ |\\ |\\ | \\ | \\ | \\ | \\ | \\ | \\ | 5+---------------------+6 | | | | +----|----------------+ | 4\\ | 3 \\ | \\ | \\ | \\ | \\ | \\| \\| +---------------------+ 1 2 + +```c++ + *Heading + box.inp + *Node + 1, 5, -5, 5 + 2, 5, 5, 5 + 3, 5, 0, 5 + 4, -5, 5, 5 + 5, 0, 5, 5 + 6, -5, -5, 5 + 7, -5, 0, 5 + 8, 0, -5, 5 + 9, 0, 0, 5 + 10, 5, 5, -5 + 11, 5, -5, -5 + 12, 5, 0, -5 + 13, -5, -5, -5 + 14, 0, -5, -5 + 15, -5, 5, -5 + 16, -5, 0, -5 + 17, 0, 5, -5 + 18, 0, 0, -5 + 19, -5, -5, 0 + 20, 5, -5, 0 + 21, 0, -5, 0 + 22, -5, 5, 0 + 23, -5, 0, 0 + 24, 5, 5, 0 + 25, 0, 5, 0 + 26, 5, 0, 0 + 27, 0, 0, 0 + *Element, type=C3D8, ELSET=EB1 + 1, 6, 19, 23, 7, 8, 21, 27, 9 + 2, 19, 13, 16, 23, 21, 14, 18, 27 + 3, 7, 23, 22, 4, 9, 27, 25, 5 + 4, 23, 16, 15, 22, 27, 18, 17, 25 + 5, 8, 21, 27, 9, 1, 20, 26, 3 + 6, 21, 14, 18, 27, 20, 11, 12, 26 + 7, 9, 27, 25, 5, 3, 26, 24, 2 + 8, 27, 18, 17, 25, 26, 12, 10, 24 +``` + +This function reads a mesh from *filename* and returns an associated p4est connectivity. +# Arguments +* `filename`:\\[in\\] file to read the connectivity from # Returns -Returns true if structure is valid, false otherwise. +an allocated connectivity associated with the mesh in *filename* ### Prototype ```c -int p4est_connectivity_is_valid (p4est_connectivity_t * connectivity); +p8est_connectivity_t *p8est_connectivity_read_inp (const char *filename); ``` """ -function p4est_connectivity_is_valid(connectivity) - @ccall libp4est.p4est_connectivity_is_valid(connectivity::Ptr{p4est_connectivity_t})::Cint +function p8est_connectivity_read_inp(filename) + @ccall libt8.p8est_connectivity_read_inp(filename::Cstring)::Ptr{p8est_connectivity_t} end """ - p4est_connectivity_is_equal(conn1, conn2) - -Check two connectivity structures for equality. + t8_cmesh_new_from_p4est(conn, comm, do_partition) -# Returns -Returns true if structures are equal, false otherwise. ### Prototype ```c -int p4est_connectivity_is_equal (p4est_connectivity_t * conn1, p4est_connectivity_t * conn2); +t8_cmesh_t t8_cmesh_new_from_p4est (p4est_connectivity_t *conn, sc_MPI_Comm comm, int do_partition); ``` """ -function p4est_connectivity_is_equal(conn1, conn2) - @ccall libp4est.p4est_connectivity_is_equal(conn1::Ptr{p4est_connectivity_t}, conn2::Ptr{p4est_connectivity_t})::Cint +function t8_cmesh_new_from_p4est(conn, comm, do_partition) + @ccall libt8.t8_cmesh_new_from_p4est(conn::Ptr{p4est_connectivity_t}, comm::Cint, do_partition::Cint)::t8_cmesh_t end """ - p4est_connectivity_sink(conn, sink) - -Write connectivity to a sink object. + t8_cmesh_new_from_p8est(conn, comm, do_partition) -# Arguments -* `conn`:\\[in\\] The connectivity to be written. -* `sink`:\\[in,out\\] The connectivity is written into this sink. -# Returns -0 on success, nonzero on error. ### Prototype ```c -int p4est_connectivity_sink (p4est_connectivity_t * conn, sc_io_sink_t * sink); +t8_cmesh_t t8_cmesh_new_from_p8est (p8est_connectivity_t *conn, sc_MPI_Comm comm, int do_partition); ``` """ -function p4est_connectivity_sink(conn, sink) - @ccall libp4est.p4est_connectivity_sink(conn::Ptr{p4est_connectivity_t}, sink::Ptr{sc_io_sink_t})::Cint +function t8_cmesh_new_from_p8est(conn, comm, do_partition) + @ccall libt8.t8_cmesh_new_from_p8est(conn::Ptr{p8est_connectivity_t}, comm::Cint, do_partition::Cint)::t8_cmesh_t end """ - p4est_connectivity_deflate(conn, code) + t8_cmesh_new_empty(comm, do_partition, dimension) -Allocate memory and store the connectivity information there. +### Prototype +```c +t8_cmesh_t t8_cmesh_new_empty (sc_MPI_Comm comm, const int do_partition, const int dimension); +``` +""" +function t8_cmesh_new_empty(comm, do_partition, dimension) + @ccall libt8.t8_cmesh_new_empty(comm::Cint, do_partition::Cint, dimension::Cint)::t8_cmesh_t +end + +""" + t8_cmesh_new_from_class(eclass, comm) -# Arguments -* `conn`:\\[in\\] The connectivity structure to be exported to memory. -* `code`:\\[in\\] Encoding and compression method for serialization. -# Returns -Newly created array that contains the information. ### Prototype ```c -sc_array_t *p4est_connectivity_deflate (p4est_connectivity_t * conn, p4est_connectivity_encode_t code); +t8_cmesh_t t8_cmesh_new_from_class (t8_eclass_t eclass, sc_MPI_Comm comm); ``` """ -function p4est_connectivity_deflate(conn, code) - @ccall libp4est.p4est_connectivity_deflate(conn::Ptr{p4est_connectivity_t}, code::p4est_connectivity_encode_t)::Ptr{sc_array_t} +function t8_cmesh_new_from_class(eclass, comm) + @ccall libt8.t8_cmesh_new_from_class(eclass::t8_eclass_t, comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_save(filename, connectivity) + t8_cmesh_new_hypercube(eclass, comm, do_bcast, do_partition, periodic) -Save a connectivity structure to disk. +### Prototype +```c +t8_cmesh_t t8_cmesh_new_hypercube (t8_eclass_t eclass, sc_MPI_Comm comm, int do_bcast, int do_partition, int periodic); +``` +""" +function t8_cmesh_new_hypercube(eclass, comm, do_bcast, do_partition, periodic) + @ccall libt8.t8_cmesh_new_hypercube(eclass::t8_eclass_t, comm::Cint, do_bcast::Cint, do_partition::Cint, periodic::Cint)::t8_cmesh_t +end + +""" + t8_cmesh_new_hypercube_pad(eclass, comm, boundary, polygons_x, polygons_y, polygons_z, use_axis_aligned) -# Arguments -* `filename`:\\[in\\] Name of the file to write. -* `connectivity`:\\[in\\] Valid connectivity structure. -# Returns -Returns 0 on success, nonzero on file error. ### Prototype ```c -int p4est_connectivity_save (const char *filename, p4est_connectivity_t * connectivity); +t8_cmesh_t t8_cmesh_new_hypercube_pad (const t8_eclass_t eclass, sc_MPI_Comm comm, const double *boundary, t8_locidx_t polygons_x, t8_locidx_t polygons_y, t8_locidx_t polygons_z, const int use_axis_aligned); ``` """ -function p4est_connectivity_save(filename, connectivity) - @ccall libp4est.p4est_connectivity_save(filename::Cstring, connectivity::Ptr{p4est_connectivity_t})::Cint +function t8_cmesh_new_hypercube_pad(eclass, comm, boundary, polygons_x, polygons_y, polygons_z, use_axis_aligned) + @ccall libt8.t8_cmesh_new_hypercube_pad(eclass::t8_eclass_t, comm::Cint, boundary::Ptr{Cdouble}, polygons_x::t8_locidx_t, polygons_y::t8_locidx_t, polygons_z::t8_locidx_t, use_axis_aligned::Cint)::t8_cmesh_t end """ - p4est_connectivity_source(source) - -Read connectivity from a source object. + t8_cmesh_new_hypercube_pad_ext(eclass, comm, boundary, polygons_x, polygons_y, polygons_z, periodic_x, periodic_y, periodic_z, use_axis_aligned, set_partition, offset) -# Arguments -* `source`:\\[in,out\\] The connectivity is read from this source. -# Returns -The newly created connectivity, or NULL on error. ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_source (sc_io_source_t * source); +t8_cmesh_t t8_cmesh_new_hypercube_pad_ext (const t8_eclass_t eclass, sc_MPI_Comm comm, const double *boundary, t8_locidx_t polygons_x, t8_locidx_t polygons_y, t8_locidx_t polygons_z, const int periodic_x, const int periodic_y, const int periodic_z, const int use_axis_aligned, const int set_partition, t8_gloidx_t offset); ``` """ -function p4est_connectivity_source(source) - @ccall libp4est.p4est_connectivity_source(source::Ptr{sc_io_source_t})::Ptr{p4est_connectivity_t} +function t8_cmesh_new_hypercube_pad_ext(eclass, comm, boundary, polygons_x, polygons_y, polygons_z, periodic_x, periodic_y, periodic_z, use_axis_aligned, set_partition, offset) + @ccall libt8.t8_cmesh_new_hypercube_pad_ext(eclass::t8_eclass_t, comm::Cint, boundary::Ptr{Cdouble}, polygons_x::t8_locidx_t, polygons_y::t8_locidx_t, polygons_z::t8_locidx_t, periodic_x::Cint, periodic_y::Cint, periodic_z::Cint, use_axis_aligned::Cint, set_partition::Cint, offset::t8_gloidx_t)::t8_cmesh_t end """ - p4est_connectivity_inflate(buffer) - -Create new connectivity from a memory buffer. This function aborts on malloc errors. + t8_cmesh_new_hypercube_hybrid(comm, do_partition, periodic) -# Arguments -* `buffer`:\\[in\\] The connectivity is created from this memory buffer. -# Returns -The newly created connectivity, or NULL on format error of the buffered connectivity data. ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_inflate (sc_array_t * buffer); +t8_cmesh_t t8_cmesh_new_hypercube_hybrid (sc_MPI_Comm comm, int do_partition, int periodic); ``` """ -function p4est_connectivity_inflate(buffer) - @ccall libp4est.p4est_connectivity_inflate(buffer::Ptr{sc_array_t})::Ptr{p4est_connectivity_t} +function t8_cmesh_new_hypercube_hybrid(comm, do_partition, periodic) + @ccall libt8.t8_cmesh_new_hypercube_hybrid(comm::Cint, do_partition::Cint, periodic::Cint)::t8_cmesh_t end """ - p4est_connectivity_load(filename, bytes) - -Load a connectivity structure from disk. + t8_cmesh_new_periodic(comm, dim) -# Arguments -* `filename`:\\[in\\] Name of the file to read. -* `bytes`:\\[in,out\\] Size in bytes of connectivity on disk or NULL. -# Returns -Returns valid connectivity, or NULL on file error. ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_load (const char *filename, size_t *bytes); +t8_cmesh_t t8_cmesh_new_periodic (sc_MPI_Comm comm, int dim); ``` """ -function p4est_connectivity_load(filename, bytes) - @ccall libp4est.p4est_connectivity_load(filename::Cstring, bytes::Ptr{Csize_t})::Ptr{p4est_connectivity_t} +function t8_cmesh_new_periodic(comm, dim) + @ccall libt8.t8_cmesh_new_periodic(comm::Cint, dim::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_unitsquare() - -Create a connectivity structure for the unit square. + t8_cmesh_new_periodic_tri(comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_unitsquare (void); +t8_cmesh_t t8_cmesh_new_periodic_tri (sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_unitsquare() - @ccall libp4est.p4est_connectivity_new_unitsquare()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_periodic_tri(comm) + @ccall libt8.t8_cmesh_new_periodic_tri(comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_periodic() - -Create a connectivity structure for an all-periodic unit square. + t8_cmesh_new_periodic_hybrid(comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_periodic (void); +t8_cmesh_t t8_cmesh_new_periodic_hybrid (sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_periodic() - @ccall libp4est.p4est_connectivity_new_periodic()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_periodic_hybrid(comm) + @ccall libt8.t8_cmesh_new_periodic_hybrid(comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_rotwrap() - -Create a connectivity structure for a periodic unit square. The left and right faces are identified, and bottom and top opposite. + t8_cmesh_new_periodic_line_more_trees(comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_rotwrap (void); +t8_cmesh_t t8_cmesh_new_periodic_line_more_trees (sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_rotwrap() - @ccall libp4est.p4est_connectivity_new_rotwrap()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_periodic_line_more_trees(comm) + @ccall libt8.t8_cmesh_new_periodic_line_more_trees(comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_circle() - -Create a connectivity structure for an donut-like circle. The circle consists of 6 trees connecting each other by their faces. The trees are laid out as a hexagon between [-2, 2] in the y direction and [-sqrt(3), sqrt(3)] in the x direction. The hexagon has flat sides along the y direction and pointy ends in x. + t8_cmesh_new_bigmesh(eclass, num_trees, comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_circle (void); +t8_cmesh_t t8_cmesh_new_bigmesh (t8_eclass_t eclass, int num_trees, sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_circle() - @ccall libp4est.p4est_connectivity_new_circle()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_bigmesh(eclass, num_trees, comm) + @ccall libt8.t8_cmesh_new_bigmesh(eclass::t8_eclass_t, num_trees::Cint, comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_drop() - -Create a connectivity structure for a five-trees geometry with a hole. The geometry covers the square [0, 3]**2, where the hole is [1, 2]**2. + t8_cmesh_new_line_zigzag(comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_drop (void); +t8_cmesh_t t8_cmesh_new_line_zigzag (sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_drop() - @ccall libp4est.p4est_connectivity_new_drop()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_line_zigzag(comm) + @ccall libt8.t8_cmesh_new_line_zigzag(comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_twotrees(l_face, r_face, orientation) - -Create a connectivity structure for two trees being rotated w.r.t. each other in a user-defined way + t8_cmesh_new_prism_cake(comm, num_of_prisms) -# Arguments -* `l_face`:\\[in\\] index of left face -* `r_face`:\\[in\\] index of right face -* `orientation`:\\[in\\] orientation of trees w.r.t. each other ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_twotrees (int l_face, int r_face, int orientation); +t8_cmesh_t t8_cmesh_new_prism_cake (sc_MPI_Comm comm, int num_of_prisms); ``` """ -function p4est_connectivity_new_twotrees(l_face, r_face, orientation) - @ccall libp4est.p4est_connectivity_new_twotrees(l_face::Cint, r_face::Cint, orientation::Cint)::Ptr{p4est_connectivity_t} +function t8_cmesh_new_prism_cake(comm, num_of_prisms) + @ccall libt8.t8_cmesh_new_prism_cake(comm::Cint, num_of_prisms::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_corner() - -Create a connectivity structure for a three-tree mesh around a corner. + t8_cmesh_new_prism_deformed(comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_corner (void); +t8_cmesh_t t8_cmesh_new_prism_deformed (sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_corner() - @ccall libp4est.p4est_connectivity_new_corner()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_prism_deformed(comm) + @ccall libt8.t8_cmesh_new_prism_deformed(comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_pillow() - -Create a connectivity structure for two trees on top of each other. + t8_cmesh_new_pyramid_deformed(comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_pillow (void); +t8_cmesh_t t8_cmesh_new_pyramid_deformed (sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_pillow() - @ccall libp4est.p4est_connectivity_new_pillow()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_pyramid_deformed(comm) + @ccall libt8.t8_cmesh_new_pyramid_deformed(comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_moebius() - -Create a connectivity structure for a five-tree moebius band. + t8_cmesh_new_prism_cake_funny_oriented(comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_moebius (void); +t8_cmesh_t t8_cmesh_new_prism_cake_funny_oriented (sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_moebius() - @ccall libp4est.p4est_connectivity_new_moebius()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_prism_cake_funny_oriented(comm) + @ccall libt8.t8_cmesh_new_prism_cake_funny_oriented(comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_star() - -Create a connectivity structure for a six-tree star. + t8_cmesh_new_prism_geometry(comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_star (void); +t8_cmesh_t t8_cmesh_new_prism_geometry (sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_star() - @ccall libp4est.p4est_connectivity_new_star()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_prism_geometry(comm) + @ccall libt8.t8_cmesh_new_prism_geometry(comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_cubed() - -Create a connectivity structure for the six sides of a unit cube. The ordering of the trees is as follows: - -0 1 2 3 <-- 3: axis-aligned top side 4 5 - -This choice has been made for maximum symmetry (see tree\\_to\\_* in .c file). + t8_cmesh_new_brick_2d(num_x, num_y, x_periodic, y_periodic, comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_cubed (void); +t8_cmesh_t t8_cmesh_new_brick_2d (t8_gloidx_t num_x, t8_gloidx_t num_y, int x_periodic, int y_periodic, sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_cubed() - @ccall libp4est.p4est_connectivity_new_cubed()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_brick_2d(num_x, num_y, x_periodic, y_periodic, comm) + @ccall libt8.t8_cmesh_new_brick_2d(num_x::t8_gloidx_t, num_y::t8_gloidx_t, x_periodic::Cint, y_periodic::Cint, comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_disk_nonperiodic() - -Create a connectivity structure for a five-tree flat spherical disk. This disk can just as well be used as a square to test non-Cartesian maps. Without any mapping this connectivity covers the square [-3, 3]**2. + t8_cmesh_new_brick_3d(num_x, num_y, num_z, x_periodic, y_periodic, z_periodic, comm) -# Returns -Initialized and usable connectivity. ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_disk_nonperiodic (void); +t8_cmesh_t t8_cmesh_new_brick_3d (t8_gloidx_t num_x, t8_gloidx_t num_y, t8_gloidx_t num_z, int x_periodic, int y_periodic, int z_periodic, sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_disk_nonperiodic() - @ccall libp4est.p4est_connectivity_new_disk_nonperiodic()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_brick_3d(num_x, num_y, num_z, x_periodic, y_periodic, z_periodic, comm) + @ccall libt8.t8_cmesh_new_brick_3d(num_x::t8_gloidx_t, num_y::t8_gloidx_t, num_z::t8_gloidx_t, x_periodic::Cint, y_periodic::Cint, z_periodic::Cint, comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_disk(periodic_a, periodic_b) - -Create a connectivity structure for a five-tree flat spherical disk. This disk can just as well be used as a square to test non-Cartesian maps. Without any mapping this connectivity covers the square [-3, 3]**2. - -!!! note - - The API of this function has changed to accept two arguments. You can query the P4EST_CONN_DISK_PERIODIC to check whether the new version with the argument is in effect. - -The ordering of the trees is as follows: - -4 1 2 3 0 - -The outside x faces may be identified topologically. The outside y faces may be identified topologically. Both identifications may be specified simultaneously. The general shape and periodicity are the same as those obtained with p4est_connectivity_new_brick (1, 1, periodic\\_a, periodic\\_b). - -When setting *periodic_a* and *periodic_b* to false, the result is the same as that of p4est_connectivity_new_disk_nonperiodic. + t8_cmesh_new_disjoint_bricks(num_x, num_y, num_z, x_periodic, y_periodic, z_periodic, comm) -# Arguments -* `periodic_a`:\\[in\\] Bool to make disk periodic in x direction. -* `periodic_b`:\\[in\\] Bool to make disk periodic in y direction. -# Returns -Initialized and usable connectivity. ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_disk (int periodic_a, int periodic_b); +t8_cmesh_t t8_cmesh_new_disjoint_bricks (t8_gloidx_t num_x, t8_gloidx_t num_y, t8_gloidx_t num_z, int x_periodic, int y_periodic, int z_periodic, sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_disk(periodic_a, periodic_b) - @ccall libp4est.p4est_connectivity_new_disk(periodic_a::Cint, periodic_b::Cint)::Ptr{p4est_connectivity_t} +function t8_cmesh_new_disjoint_bricks(num_x, num_y, num_z, x_periodic, y_periodic, z_periodic, comm) + @ccall libt8.t8_cmesh_new_disjoint_bricks(num_x::t8_gloidx_t, num_y::t8_gloidx_t, num_z::t8_gloidx_t, x_periodic::Cint, y_periodic::Cint, z_periodic::Cint, comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_icosahedron() - -Create a connectivity for mapping the sphere using an icosahedron. - -The regular icosadron is a polyhedron with 20 faces, each of which is an equilateral triangle. To build the p4est connectivity, we group faces 2 by 2 to from 10 quadrangles, and thus 10 trees. - -This connectivity is meant to be used together with p4est_geometry_new_icosahedron to map the sphere. - -The flat connectivity looks like that. Vextex numbering: - -A00 A01 A02 A03 A04 / \\ / \\ / \\ / \\ / \\ A05---A06---A07---A08---A09---A10 \\ / \\ / \\ / \\ / \\ / \\ A11---A12---A13---A14---A15---A16 \\ / \\ / \\ / \\ / \\ / A17 A18 A19 A20 A21 - -Origin in A05. - -Tree numbering: - -0 2 4 6 8 1 3 5 7 9 + t8_cmesh_new_tet_orientation_test(comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_icosahedron (void); +t8_cmesh_t t8_cmesh_new_tet_orientation_test (sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_icosahedron() - @ccall libp4est.p4est_connectivity_new_icosahedron()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_tet_orientation_test(comm) + @ccall libt8.t8_cmesh_new_tet_orientation_test(comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_shell2d() - -Create a connectivity structure that builds a 2d spherical shell. p8est_connectivity_new_shell + t8_cmesh_new_hybrid_gate(comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_shell2d (void); +t8_cmesh_t t8_cmesh_new_hybrid_gate (sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_shell2d() - @ccall libp4est.p4est_connectivity_new_shell2d()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_hybrid_gate(comm) + @ccall libt8.t8_cmesh_new_hybrid_gate(comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_disk2d() - -Create a connectivity structure that maps a 2d disk. - -This is a 5 trees connectivity meant to be used together with p4est_geometry_new_disk2d to map the disk. + t8_cmesh_new_hybrid_gate_deformed(comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_disk2d (void); +t8_cmesh_t t8_cmesh_new_hybrid_gate_deformed (sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_disk2d() - @ccall libp4est.p4est_connectivity_new_disk2d()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_hybrid_gate_deformed(comm) + @ccall libt8.t8_cmesh_new_hybrid_gate_deformed(comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_bowtie() - -Create a connectivity structure that maps a 2d bowtie structure. - -The 2 trees are connected by a corner connection at node A3 (0, 0). the nodes are given as: - -A00 A01 / \\ / \\ A02 A03 A04 \\ / \\ / A05 A06 + t8_cmesh_new_full_hybrid(comm) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_bowtie (void); +t8_cmesh_t t8_cmesh_new_full_hybrid (sc_MPI_Comm comm); ``` """ -function p4est_connectivity_new_bowtie() - @ccall libp4est.p4est_connectivity_new_bowtie()::Ptr{p4est_connectivity_t} +function t8_cmesh_new_full_hybrid(comm) + @ccall libt8.t8_cmesh_new_full_hybrid(comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_brick(mi, ni, periodic_a, periodic_b) - -A rectangular m by n array of trees with configurable periodicity. The brick is periodic in x and y if periodic\\_a and periodic\\_b are true, respectively. + t8_cmesh_new_pyramid_cake(comm, num_of_pyra) ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_brick (int mi, int ni, int periodic_a, int periodic_b); +t8_cmesh_t t8_cmesh_new_pyramid_cake (sc_MPI_Comm comm, int num_of_pyra); ``` """ -function p4est_connectivity_new_brick(mi, ni, periodic_a, periodic_b) - @ccall libp4est.p4est_connectivity_new_brick(mi::Cint, ni::Cint, periodic_a::Cint, periodic_b::Cint)::Ptr{p4est_connectivity_t} +function t8_cmesh_new_pyramid_cake(comm, num_of_pyra) + @ccall libt8.t8_cmesh_new_pyramid_cake(comm::Cint, num_of_pyra::Cint)::t8_cmesh_t end """ - p4est_connectivity_new_byname(name) - -Create connectivity structure from predefined catalogue. + t8_cmesh_new_long_brick_pyramid(comm, num_cubes) -# Arguments -* `name`:\\[in\\] Invokes connectivity\\_new\\_* function. brick23 brick (2, 3, 0, 0) corner corner cubed cubed disk disk moebius moebius periodic periodic pillow pillow rotwrap rotwrap star star unit unitsquare -# Returns -An initialized connectivity if name is defined, NULL else. ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_new_byname (const char *name); +t8_cmesh_t t8_cmesh_new_long_brick_pyramid (sc_MPI_Comm comm, int num_cubes); ``` """ -function p4est_connectivity_new_byname(name) - @ccall libp4est.p4est_connectivity_new_byname(name::Cstring)::Ptr{p4est_connectivity_t} +function t8_cmesh_new_long_brick_pyramid(comm, num_cubes) + @ccall libt8.t8_cmesh_new_long_brick_pyramid(comm::Cint, num_cubes::Cint)::t8_cmesh_t end """ - p4est_connectivity_refine(conn, num_per_dim) + t8_cmesh_new_row_of_cubes(num_trees, set_attributes, do_partition, comm, package_id) -Uniformly refine a connectivity. This is useful if you would like to uniformly refine by something other than a power of 2. - -# Arguments -* `conn`:\\[in\\] A valid connectivity -* `num_per_dim`:\\[in\\] The number of new trees in each direction. Must use no more than P4EST_OLD_QMAXLEVEL bits. -# Returns -a refined connectivity. ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_refine (p4est_connectivity_t * conn, int num_per_dim); +t8_cmesh_t t8_cmesh_new_row_of_cubes (t8_locidx_t num_trees, const int set_attributes, const int do_partition, sc_MPI_Comm comm, const int package_id); ``` """ -function p4est_connectivity_refine(conn, num_per_dim) - @ccall libp4est.p4est_connectivity_refine(conn::Ptr{p4est_connectivity_t}, num_per_dim::Cint)::Ptr{p4est_connectivity_t} +function t8_cmesh_new_row_of_cubes(num_trees, set_attributes, do_partition, comm, package_id) + @ccall libt8.t8_cmesh_new_row_of_cubes(num_trees::t8_locidx_t, set_attributes::Cint, do_partition::Cint, comm::Cint, package_id::Cint)::t8_cmesh_t end """ - p4est_expand_face_transform(iface, nface, ftransform) - -Fill an array with the axis combination of a face neighbor transform. + t8_cmesh_new_quadrangulated_disk(radius, comm) -# Arguments -* `iface`:\\[in\\] The number of the originating face. -* `nface`:\\[in\\] Encoded as nface = r * 4 + nf, where nf = 0..3 is the neigbbor's connecting face number and r = 0..1 is the relative orientation to the neighbor's face. This encoding matches [`p4est_connectivity_t`](@ref). -* `ftransform`:\\[out\\] This array holds 9 integers. [0,2] The coordinate axis sequence of the origin face, the first referring to the tangential and the second to the normal. A permutation of (0, 1). [3,5] The coordinate axis sequence of the target face. [6,8] Face reversal flag for tangential axis (boolean); face code in [0, 3] for the normal coordinate q: 0: q' = -q 1: q' = q + 1 2: q' = q - 1 3: q' = 2 - q [1,4,7] 0 (unused for compatibility with 3D). ### Prototype ```c -void p4est_expand_face_transform (int iface, int nface, int ftransform[]); +t8_cmesh_t t8_cmesh_new_quadrangulated_disk (const double radius, sc_MPI_Comm comm); ``` """ -function p4est_expand_face_transform(iface, nface, ftransform) - @ccall libp4est.p4est_expand_face_transform(iface::Cint, nface::Cint, ftransform::Ptr{Cint})::Cvoid +function t8_cmesh_new_quadrangulated_disk(radius, comm) + @ccall libt8.t8_cmesh_new_quadrangulated_disk(radius::Cdouble, comm::Cint)::t8_cmesh_t end """ - p4est_find_face_transform(connectivity, itree, iface, ftransform) - -Fill an array with the axis combinations of a tree neighbor transform. - -# Arguments -* `connectivity`:\\[in\\] Connectivity structure. -* `itree`:\\[in\\] The number of the originating tree. -* `iface`:\\[in\\] The number of the originating tree's face. -* `ftransform`:\\[out\\] This array holds 9 integers. [0,2] The coordinate axis sequence of the origin face. [3,5] The coordinate axis sequence of the target face. [6,8] Face reversal flag for axis t; face code for axis n. -# Returns -The face neighbor tree if it exists, -1 otherwise. -# See also -[`p4est_expand_face_transform`](@ref). [1,4,7] 0 (unused for compatibility with 3D). + t8_cmesh_new_triangulated_spherical_surface_octahedron(radius, comm) ### Prototype ```c -p4est_topidx_t p4est_find_face_transform (p4est_connectivity_t * connectivity, p4est_topidx_t itree, int iface, int ftransform[]); +t8_cmesh_t t8_cmesh_new_triangulated_spherical_surface_octahedron (const double radius, sc_MPI_Comm comm); ``` """ -function p4est_find_face_transform(connectivity, itree, iface, ftransform) - @ccall libp4est.p4est_find_face_transform(connectivity::Ptr{p4est_connectivity_t}, itree::p4est_topidx_t, iface::Cint, ftransform::Ptr{Cint})::p4est_topidx_t +function t8_cmesh_new_triangulated_spherical_surface_octahedron(radius, comm) + @ccall libt8.t8_cmesh_new_triangulated_spherical_surface_octahedron(radius::Cdouble, comm::Cint)::t8_cmesh_t end """ - p4est_find_corner_transform(connectivity, itree, icorner, ci) - -Fills an array with information about corner neighbors. + t8_cmesh_new_triangulated_spherical_surface_icosahedron(radius, comm) -# Arguments -* `connectivity`:\\[in\\] Connectivity structure. -* `itree`:\\[in\\] The number of the originating tree. -* `icorner`:\\[in\\] The number of the originating corner. -* `ci`:\\[in,out\\] A `p4est_corner_info_t` structure with initialized array. ### Prototype ```c -void p4est_find_corner_transform (p4est_connectivity_t * connectivity, p4est_topidx_t itree, int icorner, p4est_corner_info_t * ci); +t8_cmesh_t t8_cmesh_new_triangulated_spherical_surface_icosahedron (const double radius, sc_MPI_Comm comm); ``` """ -function p4est_find_corner_transform(connectivity, itree, icorner, ci) - @ccall libp4est.p4est_find_corner_transform(connectivity::Ptr{p4est_connectivity_t}, itree::p4est_topidx_t, icorner::Cint, ci::Ptr{p4est_corner_info_t})::Cvoid +function t8_cmesh_new_triangulated_spherical_surface_icosahedron(radius, comm) + @ccall libt8.t8_cmesh_new_triangulated_spherical_surface_icosahedron(radius::Cdouble, comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_complete(conn) - -Internally connect a connectivity based on tree\\_to\\_vertex information. Periodicity that is not inherent in the list of vertices will be lost. + t8_cmesh_new_triangulated_spherical_surface_cube(radius, comm) -# Arguments -* `conn`:\\[in,out\\] The connectivity needs to have proper vertices and tree\\_to\\_vertex fields. The tree\\_to\\_tree and tree\\_to\\_face fields must be allocated and satisfy [`p4est_connectivity_is_valid`](@ref) (conn) but will be overwritten. The corner fields will be freed and allocated anew. ### Prototype ```c -void p4est_connectivity_complete (p4est_connectivity_t * conn); +t8_cmesh_t t8_cmesh_new_triangulated_spherical_surface_cube (const double radius, sc_MPI_Comm comm); ``` """ -function p4est_connectivity_complete(conn) - @ccall libp4est.p4est_connectivity_complete(conn::Ptr{p4est_connectivity_t})::Cvoid +function t8_cmesh_new_triangulated_spherical_surface_cube(radius, comm) + @ccall libt8.t8_cmesh_new_triangulated_spherical_surface_cube(radius::Cdouble, comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_reduce(conn) - -Removes corner information of a connectivity such that enough information is left to run [`p4est_connectivity_complete`](@ref) successfully. The reduced connectivity still passes [`p4est_connectivity_is_valid`](@ref). + t8_cmesh_new_quadrangulated_spherical_surface(radius, comm) -# Arguments -* `conn`:\\[in,out\\] The connectivity to be reduced. ### Prototype ```c -void p4est_connectivity_reduce (p4est_connectivity_t * conn); +t8_cmesh_t t8_cmesh_new_quadrangulated_spherical_surface (const double radius, sc_MPI_Comm comm); ``` """ -function p4est_connectivity_reduce(conn) - @ccall libp4est.p4est_connectivity_reduce(conn::Ptr{p4est_connectivity_t})::Cvoid +function t8_cmesh_new_quadrangulated_spherical_surface(radius, comm) + @ccall libt8.t8_cmesh_new_quadrangulated_spherical_surface(radius::Cdouble, comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_permute(conn, perm, is_current_to_new) - -[`p4est_connectivity_permute`](@ref) Given a permutation *perm* of the trees in a connectivity *conn*, permute the trees of *conn* in place and update *conn* to match. + t8_cmesh_new_prismed_spherical_shell_octahedron(inner_radius, shell_thickness, num_levels, num_layers, comm) -# Arguments -* `conn`:\\[in,out\\] The connectivity whose trees are permuted. -* `perm`:\\[in\\] A permutation array, whose elements are size\\_t's. -* `is_current_to_new`:\\[in\\] if true, the jth entry of perm is the new index for the entry whose current index is j, otherwise the jth entry of perm is the current index of the tree whose index will be j after the permutation. ### Prototype ```c -void p4est_connectivity_permute (p4est_connectivity_t * conn, sc_array_t * perm, int is_current_to_new); +t8_cmesh_t t8_cmesh_new_prismed_spherical_shell_octahedron (const double inner_radius, const double shell_thickness, const int num_levels, const int num_layers, sc_MPI_Comm comm); ``` """ -function p4est_connectivity_permute(conn, perm, is_current_to_new) - @ccall libp4est.p4est_connectivity_permute(conn::Ptr{p4est_connectivity_t}, perm::Ptr{sc_array_t}, is_current_to_new::Cint)::Cvoid +function t8_cmesh_new_prismed_spherical_shell_octahedron(inner_radius, shell_thickness, num_levels, num_layers, comm) + @ccall libt8.t8_cmesh_new_prismed_spherical_shell_octahedron(inner_radius::Cdouble, shell_thickness::Cdouble, num_levels::Cint, num_layers::Cint, comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_join_faces(conn, tree_left, tree_right, face_left, face_right, orientation) - -[`p4est_connectivity_join_faces`](@ref) This function takes an existing valid connectivity *conn* and modifies it by joining two tree faces that are currently boundary faces. + t8_cmesh_new_prismed_spherical_shell_icosahedron(inner_radius, shell_thickness, num_levels, num_layers, comm) -# Arguments -* `conn`:\\[in,out\\] connectivity that will be altered. -* `tree_left`:\\[in\\] tree that will be on the left side of the joined faces. -* `tree_right`:\\[in\\] tree that will be on the right side of the joined faces. -* `face_left`:\\[in\\] face of *tree_left* that will be joined. -* `face_right`:\\[in\\] face of *tree_right* that will be joined. -* `orientation`:\\[in\\] the orientation of *face_left* and *face_right* once joined (see the description of [`p4est_connectivity_t`](@ref) to understand orientation). ### Prototype ```c -void p4est_connectivity_join_faces (p4est_connectivity_t * conn, p4est_topidx_t tree_left, p4est_topidx_t tree_right, int face_left, int face_right, int orientation); +t8_cmesh_t t8_cmesh_new_prismed_spherical_shell_icosahedron (const double inner_radius, const double shell_thickness, const int num_levels, const int num_layers, sc_MPI_Comm comm); ``` """ -function p4est_connectivity_join_faces(conn, tree_left, tree_right, face_left, face_right, orientation) - @ccall libp4est.p4est_connectivity_join_faces(conn::Ptr{p4est_connectivity_t}, tree_left::p4est_topidx_t, tree_right::p4est_topidx_t, face_left::Cint, face_right::Cint, orientation::Cint)::Cvoid +function t8_cmesh_new_prismed_spherical_shell_icosahedron(inner_radius, shell_thickness, num_levels, num_layers, comm) + @ccall libt8.t8_cmesh_new_prismed_spherical_shell_icosahedron(inner_radius::Cdouble, shell_thickness::Cdouble, num_levels::Cint, num_layers::Cint, comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_is_equivalent(conn1, conn2) - -[`p4est_connectivity_is_equivalent`](@ref) This function compares two connectivities for equivalence: it returns *true* if they are the same connectivity, or if they have the same topology. The definition of topological sameness is strict: there is no attempt made to determine whether permutation and/or rotation of the trees makes the connectivities equivalent. + t8_cmesh_new_cubed_spherical_shell(inner_radius, shell_thickness, num_trees, num_layers, comm) -# Arguments -* `conn1`:\\[in\\] a valid connectivity -* `conn2`:\\[out\\] a valid connectivity ### Prototype ```c -int p4est_connectivity_is_equivalent (p4est_connectivity_t * conn1, p4est_connectivity_t * conn2); +t8_cmesh_t t8_cmesh_new_cubed_spherical_shell (const double inner_radius, const double shell_thickness, const int num_trees, const int num_layers, sc_MPI_Comm comm); ``` """ -function p4est_connectivity_is_equivalent(conn1, conn2) - @ccall libp4est.p4est_connectivity_is_equivalent(conn1::Ptr{p4est_connectivity_t}, conn2::Ptr{p4est_connectivity_t})::Cint +function t8_cmesh_new_cubed_spherical_shell(inner_radius, shell_thickness, num_trees, num_layers, comm) + @ccall libt8.t8_cmesh_new_cubed_spherical_shell(inner_radius::Cdouble, shell_thickness::Cdouble, num_trees::Cint, num_layers::Cint, comm::Cint)::t8_cmesh_t end """ - p4est_corner_array_index(array, it) + t8_cmesh_new_cubed_sphere(radius, comm) ### Prototype ```c -static inline p4est_corner_transform_t * p4est_corner_array_index (sc_array_t * array, size_t it); +t8_cmesh_t t8_cmesh_new_cubed_sphere (const double radius, sc_MPI_Comm comm); ``` """ -function p4est_corner_array_index(array, it) - @ccall libp4est.p4est_corner_array_index(array::Ptr{sc_array_t}, it::Csize_t)::Ptr{p4est_corner_transform_t} +function t8_cmesh_new_cubed_sphere(radius, comm) + @ccall libt8.t8_cmesh_new_cubed_sphere(radius::Cdouble, comm::Cint)::t8_cmesh_t end """ - p4est_connectivity_read_inp_stream(stream, num_vertices, num_trees, vertices, tree_to_vertex) - -Read an ABAQUS input file from a file stream. - -This utility function reads a basic ABAQUS file supporting element type with the prefix C2D4, CPS4, and S4 in 2D and of type C3D8 reading them as bilinear quadrilateral and trilinear hexahedral trees respectively. - -A basic 2D mesh is given below. The `*Node` section gives the vertex number and x, y, and z components for each vertex. The `*Element` section gives the 4 vertices in 2D (8 vertices in 3D) of each element in counter clockwise order. So in 2D the nodes are given as: + t8_cmesh_set_join_by_vertices(cmesh, ntrees, eclasses, vertices, connectivity, do_both_directions) -4 3 +-------------------+ | | | | | | | | | | | | +-------------------+ 1 2 +Sets the face connectivity information of an un-committed cmesh based on a list of tree vertices. -and in 3D they are given as: +!!! warning -8 7 +---------------------+ |\\ |\\ | \\ | \\ | \\ | \\ | \\ | \\ | 5+---------------------+6 | | | | +----|----------------+ | 4\\ | 3 \\ | \\ | \\ | \\ | \\ | \\| \\| +---------------------+ 1 2 + This routine might be too expensive for very large meshes. In this case, consider to use a fully featured mesh generator. -```c++ - *Heading - box.inp - *Node - 1, -5, -5, 0 - 2, 5, -5, 0 - 3, 5, 5, 0 - 4, -5, 5, 0 - 5, 0, -5, 0 - 6, 5, 0, 0 - 7, 0, 5, 0 - 8, -5, 0, 0 - 9, 1, -1, 0 - 10, 0, 0, 0 - 11, -2, 1, 0 - *Element, type=CPS4, ELSET=Surface1 - 1, 1, 10, 11, 8 - 2, 3, 10, 9, 6 - 3, 9, 10, 1, 5 - 4, 7, 4, 8, 11 - 5, 11, 10, 3, 7 - 6, 2, 6, 9, 5 -``` +!!! note -This code can be called two ways. The first, when `vertex`==NULL and `tree_to_vertex`==NULL, is used to count the number of trees and vertices in the connectivity to be generated by the `.inp` mesh in the *stream*. The second, when `vertices`!=NULL and `tree_to_vertex`!=NULL, fill `vertices` and `tree_to_vertex`. In this case `num_vertices` and `num_trees` need to be set to the maximum number of entries allocated in `vertices` and `tree_to_vertex`. + This routine does not detect periodic boundaries. # Arguments -* `stream`:\\[in,out\\] file stream to read the connectivity from -* `num_vertices`:\\[in,out\\] the number of vertices in the connectivity -* `num_trees`:\\[in,out\\] the number of trees in the connectivity -* `vertices`:\\[out\\] the list of `vertices` of the connectivity -* `tree_to_vertex`:\\[out\\] the `tree_to_vertex` map of the connectivity -# Returns -0 if successful and nonzero if not +* `cmesh`:\\[in,out\\] Pointer to a t8code cmesh object. If set to NULL this argument is ignored. +* `ntrees`:\\[in\\] Number of coarse mesh elements resp. trees. +* `vertices`:\\[in\\] List of per element vertices with dimensions [ntrees,[`T8_ECLASS_MAX_CORNERS`](@ref),[`T8_ECLASS_MAX_DIM`](@ref)]. +* `eclasses`:\\[in\\] List of element classes of length [ntrees]. +* `connectivity`:\\[in,out\\] If connectivity is not NULL the variable is filled with a pointer to an allocated face connectivity array. The ownership of this array goes to the caller. This argument is mainly used for debugging and testing purposes. The dimension of *connectivity* are [ntrees,[`T8_ECLASS_MAX_FACES`](@ref),3]. For each element and each face the following is stored: neighbor\\_tree\\_id, neighbor\\_dual\\_face\\_id, orientation +* `do_both_directions`:\\[in\\] Compute the connectivity from both neighboring sides. Takes much longer to compute. ### Prototype ```c -int p4est_connectivity_read_inp_stream (FILE * stream, p4est_topidx_t * num_vertices, p4est_topidx_t * num_trees, double *vertices, p4est_topidx_t * tree_to_vertex); +void t8_cmesh_set_join_by_vertices (t8_cmesh_t cmesh, const t8_gloidx_t ntrees, const t8_eclass_t *eclasses, const double *vertices, int **connectivity, const int do_both_directions); ``` """ -function p4est_connectivity_read_inp_stream(stream, num_vertices, num_trees, vertices, tree_to_vertex) - @ccall libp4est.p4est_connectivity_read_inp_stream(stream::Ptr{Libc.FILE}, num_vertices::Ptr{p4est_topidx_t}, num_trees::Ptr{p4est_topidx_t}, vertices::Ptr{Cdouble}, tree_to_vertex::Ptr{p4est_topidx_t})::Cint +function t8_cmesh_set_join_by_vertices(cmesh, ntrees, eclasses, vertices, connectivity, do_both_directions) + @ccall libt8.t8_cmesh_set_join_by_vertices(cmesh::t8_cmesh_t, ntrees::t8_gloidx_t, eclasses::Ptr{t8_eclass_t}, vertices::Ptr{Cdouble}, connectivity::Ptr{Ptr{Cint}}, do_both_directions::Cint)::Cvoid end """ - p4est_connectivity_read_inp(filename) - -Create a p4est connectivity from an ABAQUS input file. - -This utility function reads a basic ABAQUS file supporting element type with the prefix C2D4, CPS4, and S4 in 2D and of type C3D8 reading them as bilinear quadrilateral and trilinear hexahedral trees respectively. - -A basic 2D mesh is given below. The `*Node` section gives the vertex number and x, y, and z components for each vertex. The `*Element` section gives the 4 vertices in 2D (8 vertices in 3D) of each element in counter clockwise order. So in 2D the nodes are given as: + t8_cmesh_set_join_by_stash(cmesh, connectivity, do_both_directions) -4 3 +-------------------+ | | | | | | | | | | | | +-------------------+ 1 2 +Sets the face connectivity information of an un-committed cmesh based on the cmesh stash. -and in 3D they are given as: +!!! warning -8 7 +---------------------+ |\\ |\\ | \\ | \\ | \\ | \\ | \\ | \\ | 5+---------------------+6 | | | | +----|----------------+ | 4\\ | 3 \\ | \\ | \\ | \\ | \\ | \\| \\| +---------------------+ 1 2 + This routine might be too expensive for very large meshes. In this case, consider to use a fully featured mesh generator. -```c++ - *Heading - box.inp - *Node - 1, -5, -5, 0 - 2, 5, -5, 0 - 3, 5, 5, 0 - 4, -5, 5, 0 - 5, 0, -5, 0 - 6, 5, 0, 0 - 7, 0, 5, 0 - 8, -5, 0, 0 - 9, 1, -1, 0 - 10, 0, 0, 0 - 11, -2, 1, 0 - *Element, type=CPS4, ELSET=Surface1 - 1, 1, 10, 11, 8 - 2, 3, 10, 9, 6 - 3, 9, 10, 1, 5 - 4, 7, 4, 8, 11 - 5, 11, 10, 3, 7 - 6, 2, 6, 9, 5 -``` +!!! note -This function reads a mesh from *filename* and returns an associated p4est connectivity. + This routine does not detect periodic boundaries. # Arguments -* `filename`:\\[in\\] file to read the connectivity from -# Returns -an allocated connectivity associated with the mesh in *filename* or NULL if an error occurred. +* `cmesh`:\\[in,out\\] An uncommitted cmesh. The trees eclasses and vertices do need to be set. +* `connectivity`:\\[in,out\\] If connectivity is not NULL the variable is filled with a pointer to an allocated face connectivity array. The ownership of this array goes to the caller. This argument is mainly used for debugging and testing purposes. The dimension of *connectivity* are [ntrees,[`T8_ECLASS_MAX_FACES`](@ref),3]. For each element and each face the following is stored: neighbor\\_tree\\_id, neighbor\\_dual\\_face\\_id, orientation +* `do_both_directions`:\\[in\\] Compute the connectivity from both neighboring sides. Takes much longer to compute. ### Prototype ```c -p4est_connectivity_t *p4est_connectivity_read_inp (const char *filename); +void t8_cmesh_set_join_by_stash (t8_cmesh_t cmesh, int **connectivity, const int do_both_directions); ``` """ -function p4est_connectivity_read_inp(filename) - @ccall libp4est.p4est_connectivity_read_inp(filename::Cstring)::Ptr{p4est_connectivity_t} -end - -""" - p8est_connect_type_t - -Characterize a type of adjacency. - -Several functions involve relationships between neighboring trees and/or quadrants, and their behavior depends on how one defines adjacency: 1) entities are adjacent if they share a face, or 2) entities are adjacent if they share a face or corner, or 3) entities are adjacent if they share a face, corner or edge. [`p8est_connect_type_t`](@ref) is used to choose the desired behavior. This enum must fit into an int8\\_t. - -| Enumerator | Note | -| :----------------------- | :------------------------------- | -| P8EST\\_CONNECT\\_SELF | No balance whatsoever. | -| P8EST\\_CONNECT\\_FACE | Balance across faces only. | -| P8EST\\_CONNECT\\_EDGE | Balance across faces and edges. | -| P8EST\\_CONNECT\\_ALMOST | = CORNER - 1. | -| P8EST\\_CONNECT\\_CORNER | Balance faces, edges, corners. | -| P8EST\\_CONNECT\\_FULL | = CORNER. | -""" -@cenum p8est_connect_type_t::UInt32 begin - P8EST_CONNECT_SELF = 30 - P8EST_CONNECT_FACE = 31 - P8EST_CONNECT_EDGE = 32 - P8EST_CONNECT_ALMOST = 32 - P8EST_CONNECT_CORNER = 33 - P8EST_CONNECT_FULL = 33 +function t8_cmesh_set_join_by_stash(cmesh, connectivity, do_both_directions) + @ccall libt8.t8_cmesh_set_join_by_stash(cmesh::t8_cmesh_t, connectivity::Ptr{Ptr{Cint}}, do_both_directions::Cint)::Cvoid end """ - p8est_connectivity_encode_t + t8_element_array_t -Typedef for serialization method. +The [`t8_element_array_t`](@ref) is an array to store [`t8_element_t`](@ref) * of a given eclass\\_scheme implementation. It is a wrapper around [`sc_array_t`](@ref). Each time, a new element is created by the functions for t8_element_array_t, the eclass function either t8_element_new or t8_element_init is called for the element. Thus, each element in a t8_element_array_t is automatically initialized properly. -| Enumerator | Note | -| :--------------------------- | :-------------------------------- | -| P8EST\\_CONN\\_ENCODE\\_LAST | Invalid entry to close the list. | +| Field | Note | +| :----------- | :----------------------------------------------------- | +| scheme | The scheme of which elements should be stored. | +| tree\\_class | !< A scheme of which elements should be stored | +| array | !< The tree class of the elements stored in the array | """ -@cenum p8est_connectivity_encode_t::UInt32 begin - P8EST_CONN_ENCODE_NONE = 0 - P8EST_CONN_ENCODE_LAST = 1 +struct t8_element_array_t + scheme::Ptr{t8_scheme_c} + tree_class::t8_eclass_t + array::sc_array_t end """ - p8est_connect_type_int(btype) + t8_element_array_new(scheme, tree_class) -Convert the [`p8est_connect_type_t`](@ref) into a number. +Creates a new array structure with 0 elements. # Arguments -* `btype`:\\[in\\] The balance type to convert. +* `scheme`:\\[in\\] The eclass scheme of which elements should be stored. +* `tree_class`:\\[in\\] The tree class of the elements stored in the array. # Returns -Returns 1, 2 or 3. +Return an allocated array of zero length. ### Prototype ```c -int p8est_connect_type_int (p8est_connect_type_t btype); +t8_element_array_t * t8_element_array_new (const t8_scheme_c *scheme, const t8_eclass_t tree_class); ``` """ -function p8est_connect_type_int(btype) - @ccall libp4est.p8est_connect_type_int(btype::p8est_connect_type_t)::Cint +function t8_element_array_new(scheme, tree_class) + @ccall libt8.t8_element_array_new(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t)::Ptr{t8_element_array_t} end """ - p8est_connect_type_string(btype) + t8_element_array_new_count(scheme, tree_class, num_elements) -Convert the [`p8est_connect_type_t`](@ref) into a const string. +Creates a new array structure with a given length (number of elements) and calls t8_element_new for those elements. # Arguments -* `btype`:\\[in\\] The balance type to convert. +* `scheme`:\\[in\\] The eclass scheme of which elements should be stored. +* `tree_class`:\\[in\\] The tree class of the elements stored in the array. +* `num_elements`:\\[in\\] Initial number of array elements. # Returns -Returns a pointer to a constant string. +Return an allocated array with allocated and initialized elements for which t8_element_new was called. ### Prototype ```c -const char *p8est_connect_type_string (p8est_connect_type_t btype); +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); ``` """ -function p8est_connect_type_string(btype) - @ccall libp4est.p8est_connect_type_string(btype::p8est_connect_type_t)::Cstring +function t8_element_array_new_count(scheme, tree_class, num_elements) + @ccall libt8.t8_element_array_new_count(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, num_elements::Csize_t)::Ptr{t8_element_array_t} end """ - p8est_connectivity - -This structure holds the 3D inter-tree connectivity information. Identification of arbitrary faces, edges and corners is possible. - -The arrays tree\\_to\\_* are stored in z ordering. For corners the order wrt. zyx is 000 001 010 011 100 101 110 111. For faces the order is -x +x -y +y -z +z. They are allocated [0][0]..[0][N-1]..[num\\_trees-1][0]..[num\\_trees-1][N-1]. where N is 6 for tree and face, 8 for corner, 12 for edge. If a face is on the physical boundary it must connect to itself. - -The values for tree\\_to\\_face are in 0..23 where ttf % 6 gives the face number and ttf / 6 the face orientation code. The orientation is determined as follows. Let my\\_face and other\\_face be the two face numbers of the connecting trees in 0..5. Then the first face corner of the lower of my\\_face and other\\_face connects to a face corner numbered 0..3 in the higher of my\\_face and other\\_face. The face orientation is defined as this number. If my\\_face == other\\_face, treating either of both faces as the lower one leads to the same result. - -It is valid to specify num\\_vertices as 0. In this case vertices and tree\\_to\\_vertex are set to NULL. Otherwise the vertex coordinates are stored in the array vertices as [0][0]..[0][2]..[num\\_vertices-1][0]..[num\\_vertices-1][2]. Vertex coordinates are optional and not used for inferring topology. - -The edges are stored when they connect trees that are not already face neighbors at that specific edge. In this case tree\\_to\\_edge indexes into *ett_offset*. Otherwise the tree\\_to\\_edge entry must be -1 and this edge is ignored. If num\\_edges == 0, tree\\_to\\_edge and edge\\_to\\_* arrays are set to NULL. - -The arrays edge\\_to\\_* store a variable number of entries per edge. For edge e these are at position [ett\\_offset[e]]..[ett\\_offset[e+1]-1]. Their number for edge e is ett\\_offset[e+1] - ett\\_offset[e]. The entries encode all trees adjacent to edge e. The size of the edge\\_to\\_* arrays is num\\_ett = ett\\_offset[num\\_edges]. The edge\\_to\\_edge array holds values in 0..23, where the lower 12 indicate one edge orientation and the higher 12 the opposite edge orientation. - -The corners are stored when they connect trees that are not already edge or face neighbors at that specific corner. In this case tree\\_to\\_corner indexes into *ctt_offset*. Otherwise the tree\\_to\\_corner entry must be -1 and this corner is ignored. If num\\_corners == 0, tree\\_to\\_corner and corner\\_to\\_* arrays are set to NULL. - -The arrays corner\\_to\\_* store a variable number of entries per corner. For corner c these are at position [ctt\\_offset[c]]..[ctt\\_offset[c+1]-1]. Their number for corner c is ctt\\_offset[c+1] - ctt\\_offset[c]. The entries encode all trees adjacent to corner c. The size of the corner\\_to\\_* arrays is num\\_ctt = ctt\\_offset[num\\_corners]. - -The *\\_to\\_attr arrays may have arbitrary contents defined by the user. + t8_element_array_init(element_array, scheme, tree_class) -!!! note - - If a connectivity implies natural connections between trees that are edge neighbors without being face neighbors, these edges shall be encoded explicitly in the connectivity. If a connectivity implies natural connections between trees that are corner neighbors without being edge or face neighbors, these corners shall be encoded explicitly in the connectivity. +Initializes an already allocated (or static) array structure. -| Field | Note | -| :------------------- | :----------------------------------------------------------------------------------- | -| num\\_vertices | the number of vertices that define the *embedding* of the forest (not the topology) | -| num\\_trees | the number of trees | -| num\\_edges | the number of edges that help define the topology | -| num\\_corners | the number of corners that help define the topology | -| vertices | an array of size (3 * *num_vertices*) | -| tree\\_to\\_vertex | embed each tree into ```c++ R^3 ``` for e.g. visualization (see p8est\\_vtk.h) | -| tree\\_attr\\_bytes | bytes per tree in tree\\_to\\_attr | -| tree\\_to\\_attr | not touched by p4est | -| tree\\_to\\_tree | (6 * *num_trees*) neighbors across faces | -| tree\\_to\\_face | (6 * *num_trees*) face to face+orientation (see description) | -| tree\\_to\\_edge | (12 * *num_trees*) or NULL (see description) | -| ett\\_offset | edge to offset in *edge_to_tree* and *edge_to_edge* | -| edge\\_to\\_tree | list of trees that meet at an edge | -| edge\\_to\\_edge | list of tree-edges+orientations that meet at an edge (see description) | -| tree\\_to\\_corner | (8 * *num_trees*) or NULL (see description) | -| ctt\\_offset | corner to offset in *corner_to_tree* and *corner_to_corner* | -| corner\\_to\\_tree | list of trees that meet at a corner | -| corner\\_to\\_corner | list of tree-corners that meet at a corner | +# Arguments +* `element_array`:\\[in,out\\] Array structure to be initialized. +* `scheme`:\\[in\\] The eclass scheme of which elements should be stored. +* `tree_class`:\\[in\\] The tree class of the elements stored in the array. +### Prototype +```c +void t8_element_array_init (t8_element_array_t *element_array, const t8_scheme_c *scheme, const t8_eclass_t tree_class); +``` """ -struct p8est_connectivity - num_vertices::p4est_topidx_t - num_trees::p4est_topidx_t - num_edges::p4est_topidx_t - num_corners::p4est_topidx_t - vertices::Ptr{Cdouble} - tree_to_vertex::Ptr{p4est_topidx_t} - tree_attr_bytes::Csize_t - tree_to_attr::Cstring - tree_to_tree::Ptr{p4est_topidx_t} - tree_to_face::Ptr{Int8} - tree_to_edge::Ptr{p4est_topidx_t} - ett_offset::Ptr{p4est_topidx_t} - edge_to_tree::Ptr{p4est_topidx_t} - edge_to_edge::Ptr{Int8} - tree_to_corner::Ptr{p4est_topidx_t} - ctt_offset::Ptr{p4est_topidx_t} - corner_to_tree::Ptr{p4est_topidx_t} - corner_to_corner::Ptr{Int8} +function t8_element_array_init(element_array, scheme, tree_class) + @ccall libt8.t8_element_array_init(element_array::Ptr{t8_element_array_t}, scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t)::Cvoid end """ -This structure holds the 3D inter-tree connectivity information. Identification of arbitrary faces, edges and corners is possible. - -The arrays tree\\_to\\_* are stored in z ordering. For corners the order wrt. zyx is 000 001 010 011 100 101 110 111. For faces the order is -x +x -y +y -z +z. They are allocated [0][0]..[0][N-1]..[num\\_trees-1][0]..[num\\_trees-1][N-1]. where N is 6 for tree and face, 8 for corner, 12 for edge. If a face is on the physical boundary it must connect to itself. - -The values for tree\\_to\\_face are in 0..23 where ttf % 6 gives the face number and ttf / 6 the face orientation code. The orientation is determined as follows. Let my\\_face and other\\_face be the two face numbers of the connecting trees in 0..5. Then the first face corner of the lower of my\\_face and other\\_face connects to a face corner numbered 0..3 in the higher of my\\_face and other\\_face. The face orientation is defined as this number. If my\\_face == other\\_face, treating either of both faces as the lower one leads to the same result. - -It is valid to specify num\\_vertices as 0. In this case vertices and tree\\_to\\_vertex are set to NULL. Otherwise the vertex coordinates are stored in the array vertices as [0][0]..[0][2]..[num\\_vertices-1][0]..[num\\_vertices-1][2]. Vertex coordinates are optional and not used for inferring topology. - -The edges are stored when they connect trees that are not already face neighbors at that specific edge. In this case tree\\_to\\_edge indexes into *ett_offset*. Otherwise the tree\\_to\\_edge entry must be -1 and this edge is ignored. If num\\_edges == 0, tree\\_to\\_edge and edge\\_to\\_* arrays are set to NULL. - -The arrays edge\\_to\\_* store a variable number of entries per edge. For edge e these are at position [ett\\_offset[e]]..[ett\\_offset[e+1]-1]. Their number for edge e is ett\\_offset[e+1] - ett\\_offset[e]. The entries encode all trees adjacent to edge e. The size of the edge\\_to\\_* arrays is num\\_ett = ett\\_offset[num\\_edges]. The edge\\_to\\_edge array holds values in 0..23, where the lower 12 indicate one edge orientation and the higher 12 the opposite edge orientation. - -The corners are stored when they connect trees that are not already edge or face neighbors at that specific corner. In this case tree\\_to\\_corner indexes into *ctt_offset*. Otherwise the tree\\_to\\_corner entry must be -1 and this corner is ignored. If num\\_corners == 0, tree\\_to\\_corner and corner\\_to\\_* arrays are set to NULL. - -The arrays corner\\_to\\_* store a variable number of entries per corner. For corner c these are at position [ctt\\_offset[c]]..[ctt\\_offset[c+1]-1]. Their number for corner c is ctt\\_offset[c+1] - ctt\\_offset[c]. The entries encode all trees adjacent to corner c. The size of the corner\\_to\\_* arrays is num\\_ctt = ctt\\_offset[num\\_corners]. + t8_element_array_init_size(element_array, scheme, tree_class, num_elements) -The *\\_to\\_attr arrays may have arbitrary contents defined by the user. - -!!! note +Initializes an already allocated (or static) array structure and allocates a given number of elements and initializes them with t8_element_init. - If a connectivity implies natural connections between trees that are edge neighbors without being face neighbors, these edges shall be encoded explicitly in the connectivity. If a connectivity implies natural connections between trees that are corner neighbors without being edge or face neighbors, these corners shall be encoded explicitly in the connectivity. +# Arguments +* `element_array`:\\[in,out\\] Array structure to be initialized. +* `scheme`:\\[in\\] The eclass scheme of which elements should be stored. +* `tree_class`:\\[in\\] The tree class of the elements stored in the array. +* `num_elements`:\\[in\\] Number of initial array elements. +### Prototype +```c +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); +``` """ -const p8est_connectivity_t = p8est_connectivity +function t8_element_array_init_size(element_array, scheme, tree_class, num_elements) + @ccall libt8.t8_element_array_init_size(element_array::Ptr{t8_element_array_t}, scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, num_elements::Csize_t)::Cvoid +end """ - p8est_connectivity_memory_used(conn) + t8_element_array_init_view(view, array, offset, length) -Calculate memory usage of a connectivity structure. +Initializes an already allocated (or static) view from existing t8\\_element\\_array. The array view returned does not require [`t8_element_array_reset`](@ref) (doesn't hurt though). # Arguments -* `conn`:\\[in\\] Connectivity structure. -# Returns -Memory used in bytes. +* `view`:\\[in,out\\] Array structure to be initialized. +* `array`:\\[in\\] The array must not be resized while view is alive. +* `offset`:\\[in\\] The offset of the viewed section in element units. This offset cannot be changed until the view is reset. +* `length`:\\[in\\] The length of the view in element units. The view cannot be resized to exceed this length. It is not necessary to call [`sc_array_reset`](@ref) later. ### Prototype ```c -size_t p8est_connectivity_memory_used (p8est_connectivity_t * conn); +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); ``` """ -function p8est_connectivity_memory_used(conn) - @ccall libp4est.p8est_connectivity_memory_used(conn::Ptr{p8est_connectivity_t})::Csize_t +function t8_element_array_init_view(view, array, offset, length) + @ccall libt8.t8_element_array_init_view(view::Ptr{t8_element_array_t}, array::Ptr{t8_element_array_t}, offset::Csize_t, length::Csize_t)::Cvoid end """ - p8est_edge_transform_t + t8_element_array_init_data(view, base, scheme, tree_class, elem_count) -Generic interface for transformations between a tree and any of its edge +Initializes an already allocated (or static) view from given plain C data (array of [`t8_element_t`](@ref)). The array view returned does not require [`t8_element_array_reset`](@ref) (doesn't hurt though). -| Field | Note | -| :------ | :--------------------------------- | -| ntree | The number of the tree | -| nedge | The number of the edge | -| naxis | The 3 edge coordinate axes | -| nflip | The orientation of the edge | -| corners | The corners connected to the edge | +# Arguments +* `view`:\\[in,out\\] Array structure to be initialized. +* `base`:\\[in\\] The data must not be moved while view is alive. Must be an array of [`t8_element_t`](@ref) corresponding to *scheme*. +* `scheme`:\\[in\\] The scheme of the elements stored in *base*. +* `tree_class`:\\[in\\] The tree class of the elements stored in *base*. +* `elem_count`:\\[in\\] The length of the view in element units. The view cannot be resized to exceed this length. It is not necessary to call [`t8_element_array_reset`](@ref) later. +### Prototype +```c +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); +``` """ -struct p8est_edge_transform_t - ntree::p4est_topidx_t - nedge::Int8 - naxis::NTuple{3, Int8} - nflip::Int8 - corners::Int8 +function t8_element_array_init_data(view, base, scheme, tree_class, elem_count) + @ccall libt8.t8_element_array_init_data(view::Ptr{t8_element_array_t}, base::Ptr{t8_element_t}, scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, elem_count::Csize_t)::Cvoid end """ - p8est_edge_info_t + t8_element_array_init_copy(element_array, scheme, tree_class, data, num_elements) -Information about the neighbors of an edge +Initializes an already allocated (or static) array structure and copy an existing array of [`t8_element_t`](@ref) into it. -| Field | Note | -| :---------------- | :---------------------------------------------- | -| iedge | The information of the edge | -| edge\\_transforms | The array of neighbors of the originating edge | +# Arguments +* `element_array`:\\[in,out\\] Array structure to be initialized. +* `scheme`:\\[in\\] The eclass scheme of which elements should be stored. +* `tree_class`:\\[in\\] The tree class of the elements stored in the array. +* `data`:\\[in\\] An array of [`t8_element_t`](@ref) which will be copied into *element_array*. The elements in *data* must belong to *scheme* and must be properly initialized with either t8_element_new or t8_element_init. +* `num_elements`:\\[in\\] Number of elements in *data* to be copied. +### Prototype +```c +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); +``` """ -struct p8est_edge_info_t - iedge::Int8 - edge_transforms::sc_array_t +function t8_element_array_init_copy(element_array, scheme, tree_class, data, num_elements) + @ccall libt8.t8_element_array_init_copy(element_array::Ptr{t8_element_array_t}, scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, data::Ptr{t8_element_t}, num_elements::Csize_t)::Cvoid end """ - p8est_corner_transform_t - -Generic interface for transformations between a tree and any of its corner + t8_element_array_resize(element_array, new_count) -| Field | Note | -| :------ | :------------------------ | -| ntree | The number of the tree | -| ncorner | The number of the corner | -""" -struct p8est_corner_transform_t - ntree::p4est_topidx_t - ncorner::Int8 -end +Change the number of elements stored in an element array. -""" - p8est_corner_info_t +!!! note -Information about the neighbors of a corner + If *new_count* is larger than the number of current elements on *element_array*, then t8_element_init is called for the new elements. -| Field | Note | -| :------------------ | :------------------------------------------------ | -| icorner | The number of the originating corner | -| corner\\_transforms | The array of neighbors of the originating corner | +# Arguments +* `element_array`:\\[in,out\\] The element array to be modified. +* `new_count`:\\[in\\] The new element count of the array. If it is zero the effect equals t8_element_array_reset. +### Prototype +```c +void t8_element_array_resize (t8_element_array_t *element_array, const size_t new_count); +``` """ -struct p8est_corner_info_t - icorner::p4est_topidx_t - corner_transforms::sc_array_t +function t8_element_array_resize(element_array, new_count) + @ccall libt8.t8_element_array_resize(element_array::Ptr{t8_element_array_t}, new_count::Csize_t)::Cvoid end """ - p8est_neighbor_transform_t + t8_element_array_copy(dest, src) -Generic interface for transformations between a tree and any of its neighbors +Copy the contents of an array into another. Both arrays must have the same eclass\\_scheme. -| Field | Note | -| :---------------- | :-------------------------------------------------------------------------- | -| neighbor\\_type | type of connection to neighbor | -| neighbor | neighbor tree index | -| index\\_self | index of interface from self's perspective | -| index\\_neighbor | index of interface from neighbor's perspective | -| perm | permutation of dimensions when transforming self coords to neighbor coords | -| sign | sign changes when transforming self coords to neighbor coords | -| origin\\_self | point on the interface from self's perspective | -| origin\\_neighbor | point on the interface from neighbor's perspective | +# Arguments +* `dest`:\\[in\\] Array will be resized and get new data. +* `src`:\\[in\\] Array used as source of new data, will not be changed. +### Prototype +```c +void t8_element_array_copy (t8_element_array_t *dest, const t8_element_array_t *src); +``` """ -struct p8est_neighbor_transform_t - neighbor_type::p8est_connect_type_t - neighbor::p4est_topidx_t - index_self::Int8 - index_neighbor::Int8 - perm::NTuple{3, Int8} - sign::NTuple{3, Int8} - origin_self::NTuple{3, p4est_qcoord_t} - origin_neighbor::NTuple{3, p4est_qcoord_t} +function t8_element_array_copy(dest, src) + @ccall libt8.t8_element_array_copy(dest::Ptr{t8_element_array_t}, src::Ptr{t8_element_array_t})::Cvoid end """ - p8est_neighbor_transform_coordinates(nt, self_coords, neigh_coords) + t8_element_array_push(element_array) -Transform from self's coordinate system to neighbor's coordinate system. +Enlarge an array by one element. # Arguments -* `nt`:\\[in\\] A neighbor transform. -* `self_coords`:\\[in\\] Input quadrant coordinates in self coordinates. -* `neigh_coords`:\\[out\\] Coordinates transformed into neighbor coordinates. +* `element_array`:\\[in,out\\] Array structure to be modified. +# Returns +Returns a pointer to a newly added element for which t8_element_init was called. ### Prototype ```c -void p8est_neighbor_transform_coordinates (const p8est_neighbor_transform_t * nt, const p4est_qcoord_t self_coords[P8EST_DIM], p4est_qcoord_t neigh_coords[P8EST_DIM]); +t8_element_t * t8_element_array_push (t8_element_array_t *element_array); ``` """ -function p8est_neighbor_transform_coordinates(nt, self_coords, neigh_coords) - @ccall libp4est.p8est_neighbor_transform_coordinates(nt::Ptr{p8est_neighbor_transform_t}, self_coords::Ptr{p4est_qcoord_t}, neigh_coords::Ptr{p4est_qcoord_t})::Cvoid +function t8_element_array_push(element_array) + @ccall libt8.t8_element_array_push(element_array::Ptr{t8_element_array_t})::Ptr{t8_element_t} end """ - p8est_neighbor_transform_coordinates_reverse(nt, neigh_coords, self_coords) + t8_element_array_push_count(element_array, count) -Transform from neighbor's coordinate system to self's coordinate system. +Enlarge an array by a number of elements. # Arguments -* `nt`:\\[in\\] A neighbor transform. -* `neigh_coords`:\\[in\\] Input quadrant coordinates in self coordinates. -* `self_coords`:\\[out\\] Coordinates transformed into neighbor coordinates. +* `element_array`:\\[in,out\\] Array structure to be modified. +* `count`:\\[in\\] The number of elements to add. +# Returns +Returns a pointer to the newly added elements for which t8_element_init was called. ### Prototype ```c -void p8est_neighbor_transform_coordinates_reverse (const p8est_neighbor_transform_t * nt, const p4est_qcoord_t neigh_coords[P8EST_DIM], p4est_qcoord_t self_coords[P8EST_DIM]); +t8_element_t * t8_element_array_push_count (t8_element_array_t *element_array, size_t count); ``` """ -function p8est_neighbor_transform_coordinates_reverse(nt, neigh_coords, self_coords) - @ccall libp4est.p8est_neighbor_transform_coordinates_reverse(nt::Ptr{p8est_neighbor_transform_t}, neigh_coords::Ptr{p4est_qcoord_t}, self_coords::Ptr{p4est_qcoord_t})::Cvoid +function t8_element_array_push_count(element_array, count) + @ccall libt8.t8_element_array_push_count(element_array::Ptr{t8_element_array_t}, count::Csize_t)::Ptr{t8_element_t} end """ - p8est_connectivity_get_neighbor_transforms(conn, tree_id, boundary_type, boundary_index, neighbor_transform_array) + t8_element_array_index_locidx(element_array, index) -Fill an array with the neighbor transforms based on a specific boundary type. This function generalizes all other inter-tree transformation objects +Return a given element in an array. Const version. # Arguments -* `conn`:\\[in\\] Connectivity structure. -* `tree_id`:\\[in\\] The number of the tree. -* `boundary_type`:\\[in\\] Type of boundary connection (self, face, edge, corner). -* `boundary_index`:\\[in\\] The index of the boundary. -* `neighbor_transform_array`:\\[in,out\\] Array of the neighbor transforms. +* `element_array`:\\[in\\] Array of elements. +* `index`:\\[in\\] The index of an element within the array. +# Returns +A pointer to the element stored at position *index* in *element_array*. ### Prototype ```c -void p8est_connectivity_get_neighbor_transforms (p8est_connectivity_t *conn, p4est_topidx_t tree_id, p8est_connect_type_t boundary_type, int boundary_index, sc_array_t *neighbor_transform_array); +const t8_element_t * t8_element_array_index_locidx (const t8_element_array_t *element_array, const t8_locidx_t index); ``` """ -function p8est_connectivity_get_neighbor_transforms(conn, tree_id, boundary_type, boundary_index, neighbor_transform_array) - @ccall libp4est.p8est_connectivity_get_neighbor_transforms(conn::Ptr{p8est_connectivity_t}, tree_id::p4est_topidx_t, boundary_type::p8est_connect_type_t, boundary_index::Cint, neighbor_transform_array::Ptr{sc_array_t})::Cvoid +function t8_element_array_index_locidx(element_array, index) + @ccall libt8.t8_element_array_index_locidx(element_array::Ptr{t8_element_array_t}, index::t8_locidx_t)::Ptr{t8_element_t} end """ - p8est_connectivity_face_neighbor_corner_set(c, f, nf, set) + t8_element_array_index_int(element_array, index) -Transform a corner across one of the adjacent faces into a neighbor tree. It expects a face permutation index that has been precomputed. +Return a given element in an array. Const version. # Arguments -* `c`:\\[in\\] A corner number in 0..7. -* `f`:\\[in\\] A face number that touches the corner *c*. -* `nf`:\\[in\\] A neighbor face that is on the other side of *f*. -* `set`:\\[in\\] A value from *p8est_face_permutation_sets* that is obtained using *f*, *nf*, and a valid orientation: ref = p8est\\_face\\_permutation\\_refs[f][nf]; set = p8est\\_face\\_permutation\\_sets[ref][orientation]; +* `element_array`:\\[in\\] Array of elements. +* `index`:\\[in\\] The index of an element within the array. # Returns -The corner number in 0..7 seen from the other face. +A pointer to the element stored at position *index* in *element_array*. ### Prototype ```c -int p8est_connectivity_face_neighbor_corner_set (int c, int f, int nf, int set); +const t8_element_t * t8_element_array_index_int (const t8_element_array_t *element_array, const int index); ``` """ -function p8est_connectivity_face_neighbor_corner_set(c, f, nf, set) - @ccall libp4est.p8est_connectivity_face_neighbor_corner_set(c::Cint, f::Cint, nf::Cint, set::Cint)::Cint +function t8_element_array_index_int(element_array, index) + @ccall libt8.t8_element_array_index_int(element_array::Ptr{t8_element_array_t}, index::Cint)::Ptr{t8_element_t} end """ - p8est_connectivity_face_neighbor_face_corner(fc, f, nf, o) + t8_element_array_index_locidx_mutable(element_array, index) -Transform a face corner across one of the adjacent faces into a neighbor tree. This version expects the neighbor face and orientation separately. +Return a given element in an array. Mutable version. # Arguments -* `fc`:\\[in\\] A face corner number in 0..3. -* `f`:\\[in\\] A face that the face corner *fc* is relative to. -* `nf`:\\[in\\] A neighbor face that is on the other side of *f*. -* `o`:\\[in\\] The orientation between tree boundary faces *f* and *nf*. +* `element_array`:\\[in\\] Array of elements. +* `index`:\\[in\\] The index of an element within the array. # Returns -The face corner number relative to the neighbor's face. +A pointer to the element stored at position *index* in *element_array*. ### Prototype ```c -int p8est_connectivity_face_neighbor_face_corner (int fc, int f, int nf, int o); +t8_element_t * t8_element_array_index_locidx_mutable (t8_element_array_t *element_array, const t8_locidx_t index); ``` """ -function p8est_connectivity_face_neighbor_face_corner(fc, f, nf, o) - @ccall libp4est.p8est_connectivity_face_neighbor_face_corner(fc::Cint, f::Cint, nf::Cint, o::Cint)::Cint +function t8_element_array_index_locidx_mutable(element_array, index) + @ccall libt8.t8_element_array_index_locidx_mutable(element_array::Ptr{t8_element_array_t}, index::t8_locidx_t)::Ptr{t8_element_t} end """ - p8est_connectivity_face_neighbor_corner(c, f, nf, o) + t8_element_array_index_int_mutable(element_array, index) -Transform a corner across one of the adjacent faces into a neighbor tree. This version expects the neighbor face and orientation separately. +Return a given element in an array. Mutable version. # Arguments -* `c`:\\[in\\] A corner number in 0..7. -* `f`:\\[in\\] A face number that touches the corner *c*. -* `nf`:\\[in\\] A neighbor face that is on the other side of *f*. -* `o`:\\[in\\] The orientation between tree boundary faces *f* and *nf*. +* `element_array`:\\[in\\] Array of elements. +* `index`:\\[in\\] The index of an element within the array. # Returns -The number of the corner seen from the neighbor tree. +A pointer to the element stored at position *index* in *element_array*. ### Prototype ```c -int p8est_connectivity_face_neighbor_corner (int c, int f, int nf, int o); +t8_element_t * t8_element_array_index_int_mutable (t8_element_array_t *element_array, const int index); ``` """ -function p8est_connectivity_face_neighbor_corner(c, f, nf, o) - @ccall libp4est.p8est_connectivity_face_neighbor_corner(c::Cint, f::Cint, nf::Cint, o::Cint)::Cint +function t8_element_array_index_int_mutable(element_array, index) + @ccall libt8.t8_element_array_index_int_mutable(element_array::Ptr{t8_element_array_t}, index::Cint)::Ptr{t8_element_t} end """ - p8est_connectivity_face_neighbor_face_edge(fe, f, nf, o) + t8_element_array_get_scheme(element_array) -Transform a face-edge across one of the adjacent faces into a neighbor tree. This version expects the neighbor face and orientation separately. +Return the eclass scheme associated to a t8\\_element\\_array. # Arguments -* `fe`:\\[in\\] A face edge number in 0..3. -* `f`:\\[in\\] A face number that touches the edge *e*. -* `nf`:\\[in\\] A neighbor face that is on the other side of *f*. -* `o`:\\[in\\] The orientation between tree boundary faces *f* and *nf*. +* `element_array`:\\[in\\] Array of elements. # Returns -The face edge number seen from the neighbor tree. +The eclass scheme stored at *element_array*. ### Prototype ```c -int p8est_connectivity_face_neighbor_face_edge (int fe, int f, int nf, int o); +const t8_scheme_c * t8_element_array_get_scheme (const t8_element_array_t *element_array); ``` """ -function p8est_connectivity_face_neighbor_face_edge(fe, f, nf, o) - @ccall libp4est.p8est_connectivity_face_neighbor_face_edge(fe::Cint, f::Cint, nf::Cint, o::Cint)::Cint +function t8_element_array_get_scheme(element_array) + @ccall libt8.t8_element_array_get_scheme(element_array::Ptr{t8_element_array_t})::Ptr{t8_scheme_c} end """ - p8est_connectivity_face_neighbor_edge(e, f, nf, o) + t8_element_array_get_tree_class(element_array) -Transform an edge across one of the adjacent faces into a neighbor tree. This version expects the neighbor face and orientation separately. +Return the tree class of the t8\\_element\\_array . # Arguments -* `e`:\\[in\\] A edge number in 0..11. -* `f`:\\[in\\] A face 0..5 that touches the edge *e*. -* `nf`:\\[in\\] A neighbor face that is on the other side of *f*. -* `o`:\\[in\\] The orientation between tree boundary faces *f* and *nf*. +* `element_array`:\\[in\\] Array of elements. # Returns -The edge's number seen from the neighbor. +The tree class stored at *element_array*. ### Prototype ```c -int p8est_connectivity_face_neighbor_edge (int e, int f, int nf, int o); +t8_eclass_t t8_element_array_get_tree_class (const t8_element_array_t *element_array); ``` """ -function p8est_connectivity_face_neighbor_edge(e, f, nf, o) - @ccall libp4est.p8est_connectivity_face_neighbor_edge(e::Cint, f::Cint, nf::Cint, o::Cint)::Cint +function t8_element_array_get_tree_class(element_array) + @ccall libt8.t8_element_array_get_tree_class(element_array::Ptr{t8_element_array_t})::t8_eclass_t end """ - p8est_connectivity_edge_neighbor_edge_corner(ec, o) + t8_element_array_get_count(element_array) -Transform an edge corner across one of the adjacent edges into a neighbor tree. +Return the number of elements stored in a [`t8_element_array_t`](@ref). # Arguments -* `ec`:\\[in\\] An edge corner number in 0..1. -* `o`:\\[in\\] The orientation of a tree boundary edge connection. +* `element_array`:\\[in\\] Array structure. # Returns -The edge corner number seen from the other tree. +The number of elements stored in *element_array*. ### Prototype ```c -int p8est_connectivity_edge_neighbor_edge_corner (int ec, int o); +size_t t8_element_array_get_count (const t8_element_array_t *element_array); ``` """ -function p8est_connectivity_edge_neighbor_edge_corner(ec, o) - @ccall libp4est.p8est_connectivity_edge_neighbor_edge_corner(ec::Cint, o::Cint)::Cint +function t8_element_array_get_count(element_array) + @ccall libt8.t8_element_array_get_count(element_array::Ptr{t8_element_array_t})::Csize_t end """ - p8est_connectivity_edge_neighbor_corner(c, e, ne, o) + t8_element_array_get_size(element_array) -Transform a corner across one of the adjacent edges into a neighbor tree. This version expects the neighbor edge and orientation separately. +Return the data size of elements stored in a [`t8_element_array_t`](@ref). # Arguments -* `c`:\\[in\\] A corner number in 0..7. -* `e`:\\[in\\] An edge 0..11 that touches the corner *c*. -* `ne`:\\[in\\] A neighbor edge that is on the other side of *e*. -* `o`:\\[in\\] The orientation between tree boundary edges *e* and *ne*. +* `element_array`:\\[in\\] Array structure. # Returns -Corner number seen from the neighbor. +The size (in bytes) of a single element in *element_array*. ### Prototype ```c -int p8est_connectivity_edge_neighbor_corner (int c, int e, int ne, int o); +size_t t8_element_array_get_size (const t8_element_array_t *element_array); ``` """ -function p8est_connectivity_edge_neighbor_corner(c, e, ne, o) - @ccall libp4est.p8est_connectivity_edge_neighbor_corner(c::Cint, e::Cint, ne::Cint, o::Cint)::Cint +function t8_element_array_get_size(element_array) + @ccall libt8.t8_element_array_get_size(element_array::Ptr{t8_element_array_t})::Csize_t end """ - p8est_connectivity_new(num_vertices, num_trees, num_edges, num_ett, num_corners, num_ctt) + t8_element_array_get_data(element_array) -Allocate a connectivity structure. The attribute fields are initialized to NULL. +Return a const pointer to the real data array stored in a t8\\_element\\_array. # Arguments -* `num_vertices`:\\[in\\] Number of total vertices (i.e. geometric points). -* `num_trees`:\\[in\\] Number of trees in the forest. -* `num_edges`:\\[in\\] Number of tree-connecting edges. -* `num_ett`:\\[in\\] Number of total trees in edge\\_to\\_tree array. -* `num_corners`:\\[in\\] Number of tree-connecting corners. -* `num_ctt`:\\[in\\] Number of total trees in corner\\_to\\_tree array. +* `element_array`:\\[in\\] Array structure. # Returns -A connectivity structure with allocated arrays. +A pointer to the stored data. If the number of stored elements is 0, then NULL is returned. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new (p4est_topidx_t num_vertices, p4est_topidx_t num_trees, p4est_topidx_t num_edges, p4est_topidx_t num_ett, p4est_topidx_t num_corners, p4est_topidx_t num_ctt); +const t8_element_t * t8_element_array_get_data (const t8_element_array_t *element_array); ``` """ -function p8est_connectivity_new(num_vertices, num_trees, num_edges, num_ett, num_corners, num_ctt) - @ccall libp4est.p8est_connectivity_new(num_vertices::p4est_topidx_t, num_trees::p4est_topidx_t, num_edges::p4est_topidx_t, num_ett::p4est_topidx_t, num_corners::p4est_topidx_t, num_ctt::p4est_topidx_t)::Ptr{p8est_connectivity_t} +function t8_element_array_get_data(element_array) + @ccall libt8.t8_element_array_get_data(element_array::Ptr{t8_element_array_t})::Ptr{t8_element_t} end """ - p8est_connectivity_new_copy(num_vertices, num_trees, num_edges, num_corners, vertices, ttv, ttt, ttf, tte, eoff, ett, ete, ttc, coff, ctt, ctc) + t8_element_array_get_data_mutable(element_array) -Allocate a connectivity structure and populate from constants. The attribute fields are initialized to NULL. +Return a pointer to the real data array stored in a t8\\_element\\_array. # Arguments -* `num_vertices`:\\[in\\] Number of total vertices (i.e. geometric points). -* `num_trees`:\\[in\\] Number of trees in the forest. -* `num_edges`:\\[in\\] Number of tree-connecting edges. -* `num_corners`:\\[in\\] Number of tree-connecting corners. -* `vertices`:\\[in\\] Coordinates of the vertices of the trees. -* `ttv`:\\[in\\] The tree-to-vertex array. -* `ttt`:\\[in\\] The tree-to-tree array. -* `ttf`:\\[in\\] The tree-to-face array (int8\\_t). -* `tte`:\\[in\\] The tree-to-edge array. -* `eoff`:\\[in\\] Edge-to-tree offsets (num\\_edges + 1 values). This must always be non-NULL; in trivial cases it is just a pointer to a p4est\\_topix value of 0. -* `ett`:\\[in\\] The edge-to-tree array. -* `ete`:\\[in\\] The edge-to-edge array. -* `ttc`:\\[in\\] The tree-to-corner array. -* `coff`:\\[in\\] Corner-to-tree offsets (num\\_corners + 1 values). This must always be non-NULL; in trivial cases it is just a pointer to a p4est\\_topix value of 0. -* `ctt`:\\[in\\] The corner-to-tree array. -* `ctc`:\\[in\\] The corner-to-corner array. +* `element_array`:\\[in\\] Array structure. # Returns -The connectivity is checked for validity. +A pointer to the stored data. If the number of stored elements is 0, then NULL is returned. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_copy (p4est_topidx_t num_vertices, p4est_topidx_t num_trees, p4est_topidx_t num_edges, p4est_topidx_t num_corners, const double *vertices, const p4est_topidx_t * ttv, const p4est_topidx_t * ttt, const int8_t * ttf, const p4est_topidx_t * tte, const p4est_topidx_t * eoff, const p4est_topidx_t * ett, const int8_t * ete, const p4est_topidx_t * ttc, const p4est_topidx_t * coff, const p4est_topidx_t * ctt, const int8_t * ctc); +t8_element_t * t8_element_array_get_data_mutable (t8_element_array_t *element_array); ``` """ -function p8est_connectivity_new_copy(num_vertices, num_trees, num_edges, num_corners, vertices, ttv, ttt, ttf, tte, eoff, ett, ete, ttc, coff, ctt, ctc) - @ccall libp4est.p8est_connectivity_new_copy(num_vertices::p4est_topidx_t, num_trees::p4est_topidx_t, num_edges::p4est_topidx_t, num_corners::p4est_topidx_t, vertices::Ptr{Cdouble}, ttv::Ptr{p4est_topidx_t}, ttt::Ptr{p4est_topidx_t}, ttf::Ptr{Int8}, tte::Ptr{p4est_topidx_t}, eoff::Ptr{p4est_topidx_t}, ett::Ptr{p4est_topidx_t}, ete::Ptr{Int8}, ttc::Ptr{p4est_topidx_t}, coff::Ptr{p4est_topidx_t}, ctt::Ptr{p4est_topidx_t}, ctc::Ptr{Int8})::Ptr{p8est_connectivity_t} +function t8_element_array_get_data_mutable(element_array) + @ccall libt8.t8_element_array_get_data_mutable(element_array::Ptr{t8_element_array_t})::Ptr{t8_element_t} end """ - p8est_connectivity_bcast(conn_in, root, comm) + t8_element_array_get_array(element_array) -### Prototype -```c -p8est_connectivity_t *p8est_connectivity_bcast (p8est_connectivity_t * conn_in, int root, sc_MPI_Comm comm); -``` -""" -function p8est_connectivity_bcast(conn_in, root, comm) - @ccall libp4est.p8est_connectivity_bcast(conn_in::Ptr{p8est_connectivity_t}, root::Cint, comm::MPI_Comm)::Ptr{p8est_connectivity_t} -end +Return a const pointer to the [`sc_array`](@ref) stored in a t8\\_element\\_array. -""" - p8est_connectivity_destroy(connectivity) +!!! note -Destroy a connectivity structure. Also destroy all attributes. + The data cannot be modified. +# Arguments +* `element_array`:\\[in\\] Array structure. +# Returns +A const pointer to the [`sc_array`](@ref) storing the data. ### Prototype ```c -void p8est_connectivity_destroy (p8est_connectivity_t * connectivity); +const sc_array_t * t8_element_array_get_array (const t8_element_array_t *element_array); ``` """ -function p8est_connectivity_destroy(connectivity) - @ccall libp4est.p8est_connectivity_destroy(connectivity::Ptr{p8est_connectivity_t})::Cvoid +function t8_element_array_get_array(element_array) + @ccall libt8.t8_element_array_get_array(element_array::Ptr{t8_element_array_t})::Ptr{sc_array_t} end """ - p8est_connectivity_set_attr(conn, bytes_per_tree) + t8_element_array_get_array_mutable(element_array) -Allocate or free the attribute fields in a connectivity. +Return a mutable pointer to the [`sc_array`](@ref) stored in a t8\\_element\\_array. + +!!! note + + The data can be modified. # Arguments -* `conn`:\\[in,out\\] The conn->*\\_to\\_attr fields must either be NULL or previously be allocated by this function. -* `bytes_per_tree`:\\[in\\] If 0, tree\\_to\\_attr is freed (being NULL is ok). If positive, requested space is allocated. +* `element_array`:\\[in\\] Array structure. +# Returns +A pointer to the [`sc_array`](@ref) storing the data. ### Prototype ```c -void p8est_connectivity_set_attr (p8est_connectivity_t * conn, size_t bytes_per_tree); +sc_array_t * t8_element_array_get_array_mutable (t8_element_array_t *element_array); ``` """ -function p8est_connectivity_set_attr(conn, bytes_per_tree) - @ccall libp4est.p8est_connectivity_set_attr(conn::Ptr{p8est_connectivity_t}, bytes_per_tree::Csize_t)::Cvoid +function t8_element_array_get_array_mutable(element_array) + @ccall libt8.t8_element_array_get_array_mutable(element_array::Ptr{t8_element_array_t})::Ptr{sc_array_t} end """ - p8est_connectivity_is_valid(connectivity) + t8_element_array_reset(element_array) -Examine a connectivity structure. +Sets the array count to zero and frees all elements. -# Returns -Returns true if structure is valid, false otherwise. +!!! note + + Calling [`t8_element_array_init`](@ref), then any array operations, then [`t8_element_array_reset`](@ref) is memory neutral. + +# Arguments +* `element_array`:\\[in,out\\] Array structure to be reset. ### Prototype ```c -int p8est_connectivity_is_valid (p8est_connectivity_t * connectivity); +void t8_element_array_reset (t8_element_array_t *element_array); ``` """ -function p8est_connectivity_is_valid(connectivity) - @ccall libp4est.p8est_connectivity_is_valid(connectivity::Ptr{p8est_connectivity_t})::Cint +function t8_element_array_reset(element_array) + @ccall libt8.t8_element_array_reset(element_array::Ptr{t8_element_array_t})::Cvoid end """ - p8est_connectivity_is_equal(conn1, conn2) + t8_element_array_truncate(element_array) -Check two connectivity structures for equality. +Sets the array count to zero, but does not free elements. -# Returns -Returns true if structures are equal, false otherwise. +!!! note + + This is intended to allow an t8\\_element\\_array to be used as a reusable buffer, where the "high water mark" of the buffer is preserved, so that O(log (max n)) reallocs occur over the life of the buffer. + +# Arguments +* `element_array`:\\[in,out\\] Element array structure to be truncated. ### Prototype ```c -int p8est_connectivity_is_equal (p8est_connectivity_t * conn1, p8est_connectivity_t * conn2); +void t8_element_array_truncate (t8_element_array_t *element_array); ``` """ -function p8est_connectivity_is_equal(conn1, conn2) - @ccall libp4est.p8est_connectivity_is_equal(conn1::Ptr{p8est_connectivity_t}, conn2::Ptr{p8est_connectivity_t})::Cint +function t8_element_array_truncate(element_array) + @ccall libt8.t8_element_array_truncate(element_array::Ptr{t8_element_array_t})::Cvoid end """ - p8est_connectivity_sink(conn, sink) - -Write connectivity to a sink object. + t8_shmem_init(comm) -# Arguments -* `conn`:\\[in\\] The connectivity to be written. -* `sink`:\\[in,out\\] The connectivity is written into this sink. -# Returns -0 on success, nonzero on error. ### Prototype ```c -int p8est_connectivity_sink (p8est_connectivity_t * conn, sc_io_sink_t * sink); +void t8_shmem_init (sc_MPI_Comm comm); ``` """ -function p8est_connectivity_sink(conn, sink) - @ccall libp4est.p8est_connectivity_sink(conn::Ptr{p8est_connectivity_t}, sink::Ptr{sc_io_sink_t})::Cint +function t8_shmem_init(comm) + @ccall libt8.t8_shmem_init(comm::Cint)::Cvoid end """ - p8est_connectivity_deflate(conn, code) - -Allocate memory and store the connectivity information there. + t8_shmem_finalize(comm) -# Arguments -* `conn`:\\[in\\] The connectivity structure to be exported to memory. -* `code`:\\[in\\] Encoding and compression method for serialization. -# Returns -Newly created array that contains the information. ### Prototype ```c -sc_array_t *p8est_connectivity_deflate (p8est_connectivity_t * conn, p8est_connectivity_encode_t code); +void t8_shmem_finalize (sc_MPI_Comm comm); ``` """ -function p8est_connectivity_deflate(conn, code) - @ccall libp4est.p8est_connectivity_deflate(conn::Ptr{p8est_connectivity_t}, code::p8est_connectivity_encode_t)::Ptr{sc_array_t} +function t8_shmem_finalize(comm) + @ccall libt8.t8_shmem_finalize(comm::Cint)::Cvoid end """ - p8est_connectivity_save(filename, connectivity) - -Save a connectivity structure to disk. + t8_shmem_set_type(comm, type) -# Arguments -* `filename`:\\[in\\] Name of the file to write. -* `connectivity`:\\[in\\] Valid connectivity structure. -# Returns -Returns 0 on success, nonzero on file error. ### Prototype ```c -int p8est_connectivity_save (const char *filename, p8est_connectivity_t * connectivity); +void t8_shmem_set_type (sc_MPI_Comm comm, sc_shmem_type_t type); ``` """ -function p8est_connectivity_save(filename, connectivity) - @ccall libp4est.p8est_connectivity_save(filename::Cstring, connectivity::Ptr{p8est_connectivity_t})::Cint +function t8_shmem_set_type(comm, type) + @ccall libt8.t8_shmem_set_type(comm::Cint, type::sc_shmem_type_t)::Cvoid end """ - p8est_connectivity_source(source) - -Read connectivity from a source object. + t8_shmem_array_init(parray, elem_size, elem_count, comm) -# Arguments -* `source`:\\[in,out\\] The connectivity is read from this source. -# Returns -The newly created connectivity, or NULL on error. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_source (sc_io_source_t * source); +void t8_shmem_array_init (t8_shmem_array_t *parray, size_t elem_size, size_t elem_count, sc_MPI_Comm comm); ``` """ -function p8est_connectivity_source(source) - @ccall libp4est.p8est_connectivity_source(source::Ptr{sc_io_source_t})::Ptr{p8est_connectivity_t} +function t8_shmem_array_init(parray, elem_size, elem_count, comm) + @ccall libt8.t8_shmem_array_init(parray::Ptr{t8_shmem_array_t}, elem_size::Csize_t, elem_count::Csize_t, comm::Cint)::Cvoid end """ - p8est_connectivity_inflate(buffer) + t8_shmem_array_start_writing(array) -Create new connectivity from a memory buffer. This function aborts on malloc errors. +Enable writing mode for a shmem array. Only some processes may be allowed to write into the array, which is indicated by the return value being non-zero. The shared memory is managed via inter- and intranode communicators. Only rank 0 of the intranode communicator will be allowed to write into the array. + +!!! note + + This function is MPI collective. # Arguments -* `buffer`:\\[in\\] The connectivity is created from this memory buffer. +* `array`:\\[in,out\\] Initialized array. Writing will be enabled on certain processes. # Returns -The newly created connectivity, or NULL on format error of the buffered connectivity data. +True if the calling process can write into the array. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_inflate (sc_array_t * buffer); +int t8_shmem_array_start_writing (t8_shmem_array_t array); ``` """ -function p8est_connectivity_inflate(buffer) - @ccall libp4est.p8est_connectivity_inflate(buffer::Ptr{sc_array_t})::Ptr{p8est_connectivity_t} +function t8_shmem_array_start_writing(array) + @ccall libt8.t8_shmem_array_start_writing(array::t8_shmem_array_t)::Cint end """ - p8est_connectivity_load(filename, bytes) + t8_shmem_array_end_writing(array) -Load a connectivity structure from disk. +Disable writing mode for a shmem array. + +!!! note + + This function is MPI collective. # Arguments -* `filename`:\\[in\\] Name of the file to read. -* `bytes`:\\[out\\] Size in bytes of connectivity on disk or NULL. -# Returns -Returns valid connectivity, or NULL on file error. +* `array`:\\[in,out\\] Initialized with writing mode enabled. +# See also +[`t8_shmem_array_start_writing`](@ref). + ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_load (const char *filename, size_t *bytes); +void t8_shmem_array_end_writing (t8_shmem_array_t array); ``` """ -function p8est_connectivity_load(filename, bytes) - @ccall libp4est.p8est_connectivity_load(filename::Cstring, bytes::Ptr{Csize_t})::Ptr{p8est_connectivity_t} +function t8_shmem_array_end_writing(array) + @ccall libt8.t8_shmem_array_end_writing(array::t8_shmem_array_t)::Cvoid end """ - p8est_connectivity_new_unitcube() + t8_shmem_array_set_gloidx(array, index, value) -Create a connectivity structure for the unit cube. +Set an entry of a t8\\_shmem array that is used to store [`t8_gloidx_t`](@ref). The array must have writing mode enabled t8_shmem_array_start_writing. +# Arguments +* `array`:\\[in,out\\] The array to be modified. +* `index`:\\[in\\] The array entry to be modified. +* `value`:\\[in\\] The new value to be set. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_unitcube (void); +void t8_shmem_array_set_gloidx (t8_shmem_array_t array, int index, t8_gloidx_t value); ``` """ -function p8est_connectivity_new_unitcube() - @ccall libp4est.p8est_connectivity_new_unitcube()::Ptr{p8est_connectivity_t} +function t8_shmem_array_set_gloidx(array, index, value) + @ccall libt8.t8_shmem_array_set_gloidx(array::t8_shmem_array_t, index::Cint, value::t8_gloidx_t)::Cvoid end """ - p8est_connectivity_new_periodic() + t8_shmem_array_copy(dest, source) -Create a connectivity structure for an all-periodic unit cube. +Copy the contents of one t8\\_shmem array into another. + +!!! note + + *dest* must be initialized and match in element size and element count to *source*. + +!!! note + + *dest* must have writing mode disabled. +# Arguments +* `dest`:\\[in,out\\] The array in which *source* should be copied. +* `source`:\\[in\\] The array to copy. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_periodic (void); +void t8_shmem_array_copy (t8_shmem_array_t dest, t8_shmem_array_t source); ``` """ -function p8est_connectivity_new_periodic() - @ccall libp4est.p8est_connectivity_new_periodic()::Ptr{p8est_connectivity_t} +function t8_shmem_array_copy(dest, source) + @ccall libt8.t8_shmem_array_copy(dest::t8_shmem_array_t, source::t8_shmem_array_t)::Cvoid end """ - p8est_connectivity_new_rotwrap() - -Create a connectivity structure for a mostly periodic unit cube. The left and right faces are identified, and bottom and top rotated. Front and back are not identified. + t8_shmem_array_allgather(sendbuf, sendcount, sendtype, recvarray, recvcount, recvtype) ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_rotwrap (void); +void t8_shmem_array_allgather (const void *sendbuf, int sendcount, sc_MPI_Datatype sendtype, t8_shmem_array_t recvarray, int recvcount, sc_MPI_Datatype recvtype); ``` """ -function p8est_connectivity_new_rotwrap() - @ccall libp4est.p8est_connectivity_new_rotwrap()::Ptr{p8est_connectivity_t} +function t8_shmem_array_allgather(sendbuf, sendcount, sendtype, recvarray, recvcount, recvtype) + @ccall libt8.t8_shmem_array_allgather(sendbuf::Ptr{Cvoid}, sendcount::Cint, sendtype::Cint, recvarray::t8_shmem_array_t, recvcount::Cint, recvtype::Cint)::Cvoid end """ - p8est_connectivity_new_drop() - -Create a connectivity structure for a five-trees geometry with a hole. The geometry is a 3D extrusion of the two drop example, and covers [0, 3]*[0, 2]*[0, 3]. The additional dimension is Y. + t8_shmem_array_allgatherv(sendbuf, sendcount, sendtype, recvarray, recvtype, comm) ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_drop (void); +void t8_shmem_array_allgatherv (void *sendbuf, const int sendcount, sc_MPI_Datatype sendtype, t8_shmem_array_t recvarray, sc_MPI_Datatype recvtype, sc_MPI_Comm comm); ``` """ -function p8est_connectivity_new_drop() - @ccall libp4est.p8est_connectivity_new_drop()::Ptr{p8est_connectivity_t} +function t8_shmem_array_allgatherv(sendbuf, sendcount, sendtype, recvarray, recvtype, comm) + @ccall libt8.t8_shmem_array_allgatherv(sendbuf::Ptr{Cvoid}, sendcount::Cint, sendtype::Cint, recvarray::t8_shmem_array_t, recvtype::Cint, comm::Cint)::Cvoid end """ - p8est_connectivity_new_twocubes() - -Create a connectivity structure that contains two cubes. + t8_shmem_array_prefix(sendbuf, recvarray, count, type, op, comm) ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_twocubes (void); +void t8_shmem_array_prefix (const void *sendbuf, t8_shmem_array_t recvarray, const int count, sc_MPI_Datatype type, sc_MPI_Op op, sc_MPI_Comm comm); ``` """ -function p8est_connectivity_new_twocubes() - @ccall libp4est.p8est_connectivity_new_twocubes()::Ptr{p8est_connectivity_t} +function t8_shmem_array_prefix(sendbuf, recvarray, count, type, op, comm) + @ccall libt8.t8_shmem_array_prefix(sendbuf::Ptr{Cvoid}, recvarray::t8_shmem_array_t, count::Cint, type::Cint, op::Cint, comm::Cint)::Cvoid end """ - p8est_connectivity_new_twotrees(l_face, r_face, orientation) - -Create a connectivity structure for two trees being rotated w.r.t. each other in a user-defined way. + t8_shmem_array_get_comm(array) -# Arguments -* `l_face`:\\[in\\] index of left face -* `r_face`:\\[in\\] index of right face -* `orientation`:\\[in\\] orientation of trees w.r.t. each other ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_twotrees (int l_face, int r_face, int orientation); +sc_MPI_Comm t8_shmem_array_get_comm (t8_shmem_array_t array); ``` """ -function p8est_connectivity_new_twotrees(l_face, r_face, orientation) - @ccall libp4est.p8est_connectivity_new_twotrees(l_face::Cint, r_face::Cint, orientation::Cint)::Ptr{p8est_connectivity_t} +function t8_shmem_array_get_comm(array) + @ccall libt8.t8_shmem_array_get_comm(array::t8_shmem_array_t)::Cint end """ - p8est_connectivity_new_twowrap() + t8_shmem_array_get_elem_size(array) -Create a connectivity structure that contains two cubes where the two far ends are identified periodically. +Get the element size of a [`t8_shmem_array`](@ref) +# Arguments +* `array`:\\[in\\] The array. +# Returns +The element size of *array*'s elements. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_twowrap (void); +size_t t8_shmem_array_get_elem_size (t8_shmem_array_t array); ``` """ -function p8est_connectivity_new_twowrap() - @ccall libp4est.p8est_connectivity_new_twowrap()::Ptr{p8est_connectivity_t} +function t8_shmem_array_get_elem_size(array) + @ccall libt8.t8_shmem_array_get_elem_size(array::t8_shmem_array_t)::Csize_t end """ - p8est_connectivity_new_rotcubes() + t8_shmem_array_get_elem_count(array) -Create a connectivity structure that contains a few cubes. These are rotated against each other to stress the topology routines. +Get the number of elements of a [`t8_shmem_array`](@ref) +# Arguments +* `array`:\\[in\\] The array. +# Returns +The number of elements in *array*. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_rotcubes (void); +size_t t8_shmem_array_get_elem_count (t8_shmem_array_t array); ``` """ -function p8est_connectivity_new_rotcubes() - @ccall libp4est.p8est_connectivity_new_rotcubes()::Ptr{p8est_connectivity_t} +function t8_shmem_array_get_elem_count(array) + @ccall libt8.t8_shmem_array_get_elem_count(array::t8_shmem_array_t)::Csize_t end """ - p8est_connectivity_new_brick(m, n, p, periodic_a, periodic_b, periodic_c) + t8_shmem_array_get_gloidx_array(array) -An m by n by p array with periodicity in x, y, and z if periodic\\_a, periodic\\_b, and periodic\\_c are true, respectively. +Return a read-only pointer to the data of a shared memory array interpreted as an [`t8_gloidx_t`](@ref) array. + +!!! note + + Writing mode must be disabled for *array*. +# Arguments +* `array`:\\[in\\] The [`t8_shmem_array`](@ref) +# Returns +The data of *array* as [`t8_gloidx_t`](@ref) pointer. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_brick (int m, int n, int p, int periodic_a, int periodic_b, int periodic_c); +const t8_gloidx_t * t8_shmem_array_get_gloidx_array (t8_shmem_array_t array); ``` """ -function p8est_connectivity_new_brick(m, n, p, periodic_a, periodic_b, periodic_c) - @ccall libp4est.p8est_connectivity_new_brick(m::Cint, n::Cint, p::Cint, periodic_a::Cint, periodic_b::Cint, periodic_c::Cint)::Ptr{p8est_connectivity_t} +function t8_shmem_array_get_gloidx_array(array) + @ccall libt8.t8_shmem_array_get_gloidx_array(array::t8_shmem_array_t)::Ptr{t8_gloidx_t} end """ - p8est_connectivity_new_shell() + t8_shmem_array_get_gloidx_array_for_writing(array) -Create a connectivity structure that builds a spherical shell. It is made up of six connected parts [-1,1]x[-1,1]x[1,2]. This connectivity reuses vertices and relies on a geometry transformation. It is thus not suitable for [`p8est_connectivity_complete`](@ref). +Return a pointer to the data of a shared memory array interpreted as an [`t8_gloidx_t`](@ref) array. The array must have writing enabled t8_shmem_array_start_writing and you should not write into the memory after t8_shmem_array_end_writing was called. +# Arguments +* `array`:\\[in\\] The [`t8_shmem_array`](@ref) +# Returns +The data of *array* as [`t8_gloidx_t`](@ref) pointer. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_shell (void); +t8_gloidx_t * t8_shmem_array_get_gloidx_array_for_writing (t8_shmem_array_t array); ``` """ -function p8est_connectivity_new_shell() - @ccall libp4est.p8est_connectivity_new_shell()::Ptr{p8est_connectivity_t} +function t8_shmem_array_get_gloidx_array_for_writing(array) + @ccall libt8.t8_shmem_array_get_gloidx_array_for_writing(array::t8_shmem_array_t)::Ptr{t8_gloidx_t} end """ - p8est_connectivity_new_sphere() + t8_shmem_array_get_gloidx(array, index) -Create a connectivity structure that builds a solid sphere. It is made up of two layers and a cube in the center. This connectivity reuses vertices and relies on a geometry transformation. It is thus not suitable for [`p8est_connectivity_complete`](@ref). +Return an entry of a shared memory array that stores [`t8_gloidx_t`](@ref). + +!!! note + + Writing mode must be disabled for *array*. +# Arguments +* `array`:\\[in\\] The [`t8_shmem_array`](@ref) +* `index`:\\[in\\] The index of the entry to be queried. +# Returns +The *index*-th entry of *array* as [`t8_gloidx_t`](@ref). ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_sphere (void); +t8_gloidx_t t8_shmem_array_get_gloidx (t8_shmem_array_t array, int index); ``` """ -function p8est_connectivity_new_sphere() - @ccall libp4est.p8est_connectivity_new_sphere()::Ptr{p8est_connectivity_t} +function t8_shmem_array_get_gloidx(array, index) + @ccall libt8.t8_shmem_array_get_gloidx(array::t8_shmem_array_t, index::Cint)::t8_gloidx_t end """ - p8est_connectivity_new_torus(nSegments) - -Create a connectivity structure that builds a revolution torus. + t8_shmem_array_get_array(array) -This connectivity reuses vertices and relies on a geometry transformation. It is thus not suitable for [`p8est_connectivity_complete`](@ref). +Return a pointer to the data array of a [`t8_shmem_array`](@ref). -This connectivity reuses ideas from disk2d connectivity. More precisely the torus is divided into segments around the revolution axis, each segments is made of 5 trees (Ă  la disk2d). The total number of trees if 5 times the number of segments. +!!! note -This connectivity is meant to be used with p8est_geometry_new_torus + Writing mode must be disabled for *array*. # Arguments -* `nSegments`:\\[in\\] number of trees along the great circle +* `array`:\\[in\\] The [`t8_shmem_array`](@ref). +# Returns +A pointer to the data array of *array*. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_torus (int nSegments); +const void * t8_shmem_array_get_array (t8_shmem_array_t array); ``` """ -function p8est_connectivity_new_torus(nSegments) - @ccall libp4est.p8est_connectivity_new_torus(nSegments::Cint)::Ptr{p8est_connectivity_t} +function t8_shmem_array_get_array(array) + @ccall libt8.t8_shmem_array_get_array(array::t8_shmem_array_t)::Ptr{Cvoid} end """ - p8est_connectivity_new_byname(name) + t8_shmem_array_index(array, index) -Create connectivity structure from predefined catalogue. +Return a read-only pointer to an element in a [`t8_shmem_array`](@ref). + +!!! note + + You should not modify the value. + +!!! note + + Writing mode must be disabled for *array*. # Arguments -* `name`:\\[in\\] Invokes connectivity\\_new\\_* function. brick235 brick (2, 3, 5, 0, 0, 0) periodic periodic rotcubes rotcubes rotwrap rotwrap shell shell sphere sphere twocubes twocubes twowrap twowrap unit unitcube +* `array`:\\[in\\] The [`t8_shmem_array`](@ref). +* `index`:\\[in\\] The index of an element. # Returns -An initialized connectivity if name is defined, NULL else. +A pointer to the element at *index* in *array*. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_new_byname (const char *name); +const void * t8_shmem_array_index (t8_shmem_array_t array, size_t index); ``` """ -function p8est_connectivity_new_byname(name) - @ccall libp4est.p8est_connectivity_new_byname(name::Cstring)::Ptr{p8est_connectivity_t} +function t8_shmem_array_index(array, index) + @ccall libt8.t8_shmem_array_index(array::t8_shmem_array_t, index::Csize_t)::Ptr{Cvoid} end """ - p8est_connectivity_refine(conn, num_per_dim) + t8_shmem_array_index_for_writing(array, index) -Uniformly refine a connectivity. This is useful if you would like to uniformly refine by something other than a power of 2. +Return a pointer to an element in a [`t8_shmem_array`](@ref) in writing mode. + +!!! note + + You can modify the value before the next call to t8_shmem_array_end_writing. + +!!! note + + Writing mode must be enabled for *array*. # Arguments -* `conn`:\\[in\\] A valid connectivity -* `num_per_dim`:\\[in\\] The number of new trees in each direction. Must use no more than P8EST_OLD_QMAXLEVEL bits. +* `array`:\\[in\\] The [`t8_shmem_array`](@ref). +* `index`:\\[in\\] The index of an element. # Returns -a refined connectivity. +A pointer to the element at *index* in *array*. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_refine (p8est_connectivity_t * conn, int num_per_dim); +void * t8_shmem_array_index_for_writing (t8_shmem_array_t array, size_t index); ``` """ -function p8est_connectivity_refine(conn, num_per_dim) - @ccall libp4est.p8est_connectivity_refine(conn::Ptr{p8est_connectivity_t}, num_per_dim::Cint)::Ptr{p8est_connectivity_t} +function t8_shmem_array_index_for_writing(array, index) + @ccall libt8.t8_shmem_array_index_for_writing(array::t8_shmem_array_t, index::Csize_t)::Ptr{Cvoid} end """ - p8est_expand_face_transform(iface, nface, ftransform) + t8_shmem_array_is_equal(array_a, array_b) -Fill an array with the axis combination of a face neighbor transform. +Check if two t8\\_shmem arrays are equal. + +!!! note + + Writing mode must be disabled for *array_a* and *array_b*. # Arguments -* `iface`:\\[in\\] The number of the originating face. -* `nface`:\\[in\\] Encoded as nface = r * 6 + nf, where nf = 0..5 is the neigbbor's connecting face number and r = 0..3 is the relative orientation to the neighbor's face. This encoding matches [`p8est_connectivity_t`](@ref). -* `ftransform`:\\[out\\] This array holds 9 integers. [0]..[2] The coordinate axis sequence of the origin face, the first two referring to the tangentials and the third to the normal. A permutation of (0, 1, 2). [3]..[5] The coordinate axis sequence of the target face. [6]..[8] Edge reversal flags for tangential axes (boolean); face code in [0, 3] for the normal coordinate q: 0: q' = -q 1: q' = q + 1 2: q' = q - 1 3: q' = 2 - q +* `array_a`:\\[in\\] The first [`t8_shmem_array`](@ref) to compare. +* `array_b`:\\[in\\] The second [`t8_shmem_array`](@ref) to compare. +# Returns +1 if the arrays are equal, 0 otherwise. ### Prototype ```c -void p8est_expand_face_transform (int iface, int nface, int ftransform[]); +int t8_shmem_array_is_equal (t8_shmem_array_t array_a, t8_shmem_array_t array_b); ``` """ -function p8est_expand_face_transform(iface, nface, ftransform) - @ccall libp4est.p8est_expand_face_transform(iface::Cint, nface::Cint, ftransform::Ptr{Cint})::Cvoid +function t8_shmem_array_is_equal(array_a, array_b) + @ccall libt8.t8_shmem_array_is_equal(array_a::t8_shmem_array_t, array_b::t8_shmem_array_t)::Cint end """ - p8est_find_face_transform(connectivity, itree, iface, ftransform) + t8_shmem_array_destroy(parray) -Fill an array with the axis combination of a face neighbor transform. +Free all memory associated with a [`t8_shmem_array`](@ref). # Arguments -* `connectivity`:\\[in\\] Connectivity structure. -* `itree`:\\[in\\] The number of the originating tree. -* `iface`:\\[in\\] The number of the originating tree's face. -* `ftransform`:\\[out\\] This array holds 9 integers. [0]..[2] The coordinate axis sequence of the origin face. [3]..[5] The coordinate axis sequence of the target face. [6]..[8] Edge reversal flag for axes t1, t2; face code for n; -# Returns -The face neighbor tree if it exists, -1 otherwise. -# See also -[`p8est_expand_face_transform`](@ref). - +* `parray`:\\[in,out\\] On input a pointer to a valid [`t8_shmem_array`](@ref). This array is freed and *parray* is set to NULL on return. ### Prototype ```c -p4est_topidx_t p8est_find_face_transform (p8est_connectivity_t * connectivity, p4est_topidx_t itree, int iface, int ftransform[]); +void t8_shmem_array_destroy (t8_shmem_array_t *parray); ``` """ -function p8est_find_face_transform(connectivity, itree, iface, ftransform) - @ccall libp4est.p8est_find_face_transform(connectivity::Ptr{p8est_connectivity_t}, itree::p4est_topidx_t, iface::Cint, ftransform::Ptr{Cint})::p4est_topidx_t +function t8_shmem_array_destroy(parray) + @ccall libt8.t8_shmem_array_destroy(parray::Ptr{t8_shmem_array_t})::Cvoid end """ - p8est_find_edge_transform(connectivity, itree, iedge, ei) + t8_shmem_array_binary_search(array, value, size, compare) -Fills an array with information about edge neighbors. +Perform a binary search in a [`t8_shmem_array`](@ref). # Arguments -* `connectivity`:\\[in\\] Connectivity structure. -* `itree`:\\[in\\] The number of the originating tree. -* `iedge`:\\[in\\] The number of the originating edge. -* `ei`:\\[in,out\\] A `p8est_edge_info_t` structure with initialized array. +* `array`:\\[in\\] The [`t8_shmem_array`](@ref) to search in. +* `value`:\\[in\\] The value to search for. +* `size`:\\[in\\] The number of elements in the array. +* `compare`:\\[in\\] A function that compares an element of the array with the value. +# Returns +The index of the element in *array* that matches *value*. ### Prototype ```c -void p8est_find_edge_transform (p8est_connectivity_t * connectivity, p4est_topidx_t itree, int iedge, p8est_edge_info_t * ei); +int t8_shmem_array_binary_search (t8_shmem_array_t array, const t8_gloidx_t value, const int size, int (*compare) (t8_shmem_array_t, const int, const t8_gloidx_t)); ``` """ -function p8est_find_edge_transform(connectivity, itree, iedge, ei) - @ccall libp4est.p8est_find_edge_transform(connectivity::Ptr{p8est_connectivity_t}, itree::p4est_topidx_t, iedge::Cint, ei::Ptr{p8est_edge_info_t})::Cvoid +function t8_shmem_array_binary_search(array, value, size, compare) + @ccall libt8.t8_shmem_array_binary_search(array::t8_shmem_array_t, value::t8_gloidx_t, size::Cint, compare::Ptr{Cvoid})::Cint end """ - p8est_find_corner_transform(connectivity, itree, icorner, ci) + sc_keyvalue_entry_type_t -Fills an array with information about corner neighbors. +The values can have different types. -# Arguments -* `connectivity`:\\[in\\] Connectivity structure. -* `itree`:\\[in\\] The number of the originating tree. -* `icorner`:\\[in\\] The number of the originating corner. -* `ci`:\\[in,out\\] A `p8est_corner_info_t` structure with initialized array. -### Prototype -```c -void p8est_find_corner_transform (p8est_connectivity_t * connectivity, p4est_topidx_t itree, int icorner, p8est_corner_info_t * ci); -``` +| Enumerator | Note | +| :------------------------------ | :------------------------------------------ | +| SC\\_KEYVALUE\\_ENTRY\\_NONE | Designate an invalid situation. | +| SC\\_KEYVALUE\\_ENTRY\\_INT | Used for values of type int. | +| SC\\_KEYVALUE\\_ENTRY\\_DOUBLE | Used for values of type double. | +| SC\\_KEYVALUE\\_ENTRY\\_STRING | Used for values of type const char *. | +| SC\\_KEYVALUE\\_ENTRY\\_POINTER | Used for values of anonymous pointer type. | """ -function p8est_find_corner_transform(connectivity, itree, icorner, ci) - @ccall libp4est.p8est_find_corner_transform(connectivity::Ptr{p8est_connectivity_t}, itree::p4est_topidx_t, icorner::Cint, ci::Ptr{p8est_corner_info_t})::Cvoid +@cenum sc_keyvalue_entry_type_t::UInt32 begin + SC_KEYVALUE_ENTRY_NONE = 0 + SC_KEYVALUE_ENTRY_INT = 1 + SC_KEYVALUE_ENTRY_DOUBLE = 2 + SC_KEYVALUE_ENTRY_STRING = 3 + SC_KEYVALUE_ENTRY_POINTER = 4 end +mutable struct sc_keyvalue end + +"""The key-value container is an opaque structure.""" +const sc_keyvalue_t = sc_keyvalue + +# no prototype is found for this function at sc_keyvalue.h:54:21, please use with caution """ - p8est_connectivity_complete(conn) + sc_keyvalue_new() -Internally connect a connectivity based on tree\\_to\\_vertex information. Periodicity that is not inherent in the list of vertices will be lost. +Create a new key-value container. -# Arguments -* `conn`:\\[in,out\\] The connectivity needs to have proper vertices and tree\\_to\\_vertex fields. The tree\\_to\\_tree and tree\\_to\\_face fields must be allocated and satisfy [`p8est_connectivity_is_valid`](@ref) (conn) but will be overwritten. The edge and corner fields will be freed and allocated anew. +# Returns +The container is ready to use. ### Prototype ```c -void p8est_connectivity_complete (p8est_connectivity_t * conn); +sc_keyvalue_t *sc_keyvalue_new (); ``` """ -function p8est_connectivity_complete(conn) - @ccall libp4est.p8est_connectivity_complete(conn::Ptr{p8est_connectivity_t})::Cvoid +function sc_keyvalue_new() + @ccall libt8.sc_keyvalue_new()::Ptr{sc_keyvalue_t} end +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function sc_keyvalue_newf(dummy, va_list...) + :(@ccall(libt8.sc_keyvalue_newf(dummy::Cint; $(to_c_type_pairs(va_list)...))::Ptr{sc_keyvalue_t})) + end + """ - p8est_connectivity_reduce(conn) + sc_keyvalue_destroy(kv) -Removes corner and edge information of a connectivity such that enough information is left to run [`p8est_connectivity_complete`](@ref) successfully. The reduced connectivity still passes [`p8est_connectivity_is_valid`](@ref). +Free a key-value container and all internal memory for key storage. # Arguments -* `conn`:\\[in,out\\] The connectivity to be reduced. +* `kv`:\\[in,out\\] The key-value container is invalidated by this call. ### Prototype ```c -void p8est_connectivity_reduce (p8est_connectivity_t * conn); +void sc_keyvalue_destroy (sc_keyvalue_t * kv); ``` """ -function p8est_connectivity_reduce(conn) - @ccall libp4est.p8est_connectivity_reduce(conn::Ptr{p8est_connectivity_t})::Cvoid +function sc_keyvalue_destroy(kv) + @ccall libt8.sc_keyvalue_destroy(kv::Ptr{sc_keyvalue_t})::Cvoid end """ - p8est_connectivity_permute(conn, perm, is_current_to_new) + sc_keyvalue_exists(kv, key) -[`p8est_connectivity_permute`](@ref) Given a permutation *perm* of the trees in a connectivity *conn*, permute the trees of *conn* in place and update *conn* to match. +Routine to check existence of an entry. # Arguments -* `conn`:\\[in,out\\] The connectivity whose trees are permuted. -* `perm`:\\[in\\] A permutation array, whose elements are size\\_t's. -* `is_current_to_new`:\\[in\\] if true, the jth entry of perm is the new index for the entry whose current index is j, otherwise the jth entry of perm is the current index of the tree whose index will be j after the permutation. +* `kv`:\\[in\\] Valid key-value container. +* `key`:\\[in\\] Lookup key to query. +# Returns +The entry's type if found and SC\\_KEYVALUE\\_ENTRY\\_NONE otherwise. ### Prototype ```c -void p8est_connectivity_permute (p8est_connectivity_t * conn, sc_array_t * perm, int is_current_to_new); +sc_keyvalue_entry_type_t sc_keyvalue_exists (sc_keyvalue_t * kv, const char *key); ``` """ -function p8est_connectivity_permute(conn, perm, is_current_to_new) - @ccall libp4est.p8est_connectivity_permute(conn::Ptr{p8est_connectivity_t}, perm::Ptr{sc_array_t}, is_current_to_new::Cint)::Cvoid +function sc_keyvalue_exists(kv, key) + @ccall libt8.sc_keyvalue_exists(kv::Ptr{sc_keyvalue_t}, key::Cstring)::sc_keyvalue_entry_type_t end """ - p8est_connectivity_join_faces(conn, tree_left, tree_right, face_left, face_right, orientation) + sc_keyvalue_unset(kv, key) -[`p8est_connectivity_join_faces`](@ref) This function takes an existing valid connectivity *conn* and modifies it by joining two tree faces that are currently boundary faces. +Routine to remove an entry. # Arguments -* `conn`:\\[in,out\\] connectivity that will be altered. -* `tree_left`:\\[in\\] tree that will be on the left side of the joined faces. -* `tree_right`:\\[in\\] tree that will be on the right side of the joined faces. -* `face_left`:\\[in\\] face of *tree_left* that will be joined. -* `face_right`:\\[in\\] face of *tree_right* that will be joined. -* `orientation`:\\[in\\] the orientation of *face_left* and *face_right* once joined (see the description of [`p8est_connectivity_t`](@ref) to understand orientation). +* `kv`:\\[in\\] Valid key-value container. +* `key`:\\[in\\] Lookup key to remove if it exists. +# Returns +The entry's type if found and removed, SC\\_KEYVALUE\\_ENTRY\\_NONE otherwise. ### Prototype ```c -void p8est_connectivity_join_faces (p8est_connectivity_t * conn, p4est_topidx_t tree_left, p4est_topidx_t tree_right, int face_left, int face_right, int orientation); +sc_keyvalue_entry_type_t sc_keyvalue_unset (sc_keyvalue_t * kv, const char *key); ``` """ -function p8est_connectivity_join_faces(conn, tree_left, tree_right, face_left, face_right, orientation) - @ccall libp4est.p8est_connectivity_join_faces(conn::Ptr{p8est_connectivity_t}, tree_left::p4est_topidx_t, tree_right::p4est_topidx_t, face_left::Cint, face_right::Cint, orientation::Cint)::Cvoid +function sc_keyvalue_unset(kv, key) + @ccall libt8.sc_keyvalue_unset(kv::Ptr{sc_keyvalue_t}, key::Cstring)::sc_keyvalue_entry_type_t end """ - p8est_connectivity_is_equivalent(conn1, conn2) + sc_keyvalue_get_int(kv, key, dvalue) -[`p8est_connectivity_is_equivalent`](@ref) This function compares two connectivities for equivalence: it returns *true* if they are the same connectivity, or if they have the same topology. The definition of topological sameness is strict: there is no attempt made to determine whether permutation and/or rotation of the trees makes the connectivities equivalent. +Routines to retrieve an integer value by its key. This function asserts that the key, if existing, points to the correct type. # Arguments -* `conn1`:\\[in\\] a valid connectivity -* `conn2`:\\[out\\] a valid connectivity +* `kv`:\\[in\\] Valid key-value container. +* `key`:\\[in\\] Lookup key, may or may not exist. +* `dvalue`:\\[in\\] Default value returned if key is not found. +# Returns +If key is not present then **dvalue** is returned, otherwise the value stored under **key**. ### Prototype ```c -int p8est_connectivity_is_equivalent (p8est_connectivity_t * conn1, p8est_connectivity_t * conn2); +int sc_keyvalue_get_int (sc_keyvalue_t * kv, const char *key, int dvalue); ``` """ -function p8est_connectivity_is_equivalent(conn1, conn2) - @ccall libp4est.p8est_connectivity_is_equivalent(conn1::Ptr{p8est_connectivity_t}, conn2::Ptr{p8est_connectivity_t})::Cint +function sc_keyvalue_get_int(kv, key, dvalue) + @ccall libt8.sc_keyvalue_get_int(kv::Ptr{sc_keyvalue_t}, key::Cstring, dvalue::Cint)::Cint end """ - p8est_edge_array_index(array, it) + sc_keyvalue_get_double(kv, key, dvalue) + +Retrieve a double value by its key. This function asserts that the key, if existing, points to the correct type. +# Arguments +* `kv`:\\[in\\] Valid key-value container. +* `key`:\\[in\\] Lookup key, may or may not exist. +* `dvalue`:\\[in\\] Default value returned if key is not found. +# Returns +If key is not present then **dvalue** is returned, otherwise the value stored under **key**. ### Prototype ```c -static inline p8est_edge_transform_t * p8est_edge_array_index (sc_array_t * array, size_t it); +double sc_keyvalue_get_double (sc_keyvalue_t * kv, const char *key, double dvalue); ``` """ -function p8est_edge_array_index(array, it) - @ccall libp4est.p8est_edge_array_index(array::Ptr{sc_array_t}, it::Csize_t)::Ptr{p8est_edge_transform_t} +function sc_keyvalue_get_double(kv, key, dvalue) + @ccall libt8.sc_keyvalue_get_double(kv::Ptr{sc_keyvalue_t}, key::Cstring, dvalue::Cdouble)::Cdouble end """ - p8est_corner_array_index(array, it) + sc_keyvalue_get_string(kv, key, dvalue) + +Retrieve a string value by its key. This function asserts that the key, if existing, points to the correct type. +# Arguments +* `kv`:\\[in\\] Valid key-value container. +* `key`:\\[in\\] Lookup key, may or may not exist. +* `dvalue`:\\[in\\] Default value returned if key is not found. +# Returns +If key is not present then **dvalue** is returned, otherwise the value stored under **key**. ### Prototype ```c -static inline p8est_corner_transform_t * p8est_corner_array_index (sc_array_t * array, size_t it); +const char *sc_keyvalue_get_string (sc_keyvalue_t * kv, const char *key, const char *dvalue); ``` """ -function p8est_corner_array_index(array, it) - @ccall libp4est.p8est_corner_array_index(array::Ptr{sc_array_t}, it::Csize_t)::Ptr{p8est_corner_transform_t} +function sc_keyvalue_get_string(kv, key, dvalue) + @ccall libt8.sc_keyvalue_get_string(kv::Ptr{sc_keyvalue_t}, key::Cstring, dvalue::Cstring)::Cstring end """ - p8est_connectivity_read_inp_stream(stream, num_vertices, num_trees, vertices, tree_to_vertex) - -Read an ABAQUS input file from a file stream. - -This utility function reads a basic ABAQUS file supporting element type with the prefix C2D4, CPS4, and S4 in 2D and of type C3D8 reading them as bilinear quadrilateral and trilinear hexahedral trees respectively. - -A basic 2D mesh is given below. The `*Node` section gives the vertex number and x, y, and z components for each vertex. The `*Element` section gives the 4 vertices in 2D (8 vertices in 3D) of each element in counter clockwise order. So in 2D the nodes are given as: - -4 3 +-------------------+ | | | | | | | | | | | | +-------------------+ 1 2 - -and in 3D they are given as: + sc_keyvalue_get_pointer(kv, key, dvalue) -8 7 +---------------------+ |\\ |\\ | \\ | \\ | \\ | \\ | \\ | \\ | 5+---------------------+6 | | | | +----|----------------+ | 4\\ | 3 \\ | \\ | \\ | \\ | \\ | \\| \\| +---------------------+ 1 2 +Retrieve a pointer value by its key. This function asserts that the key, if existing, points to the correct type. -```c++ - *Heading - box.inp - *Node - 1, 5, -5, 5 - 2, 5, 5, 5 - 3, 5, 0, 5 - 4, -5, 5, 5 - 5, 0, 5, 5 - 6, -5, -5, 5 - 7, -5, 0, 5 - 8, 0, -5, 5 - 9, 0, 0, 5 - 10, 5, 5, -5 - 11, 5, -5, -5 - 12, 5, 0, -5 - 13, -5, -5, -5 - 14, 0, -5, -5 - 15, -5, 5, -5 - 16, -5, 0, -5 - 17, 0, 5, -5 - 18, 0, 0, -5 - 19, -5, -5, 0 - 20, 5, -5, 0 - 21, 0, -5, 0 - 22, -5, 5, 0 - 23, -5, 0, 0 - 24, 5, 5, 0 - 25, 0, 5, 0 - 26, 5, 0, 0 - 27, 0, 0, 0 - *Element, type=C3D8, ELSET=EB1 - 1, 6, 19, 23, 7, 8, 21, 27, 9 - 2, 19, 13, 16, 23, 21, 14, 18, 27 - 3, 7, 23, 22, 4, 9, 27, 25, 5 - 4, 23, 16, 15, 22, 27, 18, 17, 25 - 5, 8, 21, 27, 9, 1, 20, 26, 3 - 6, 21, 14, 18, 27, 20, 11, 12, 26 - 7, 9, 27, 25, 5, 3, 26, 24, 2 - 8, 27, 18, 17, 25, 26, 12, 10, 24 +# Arguments +* `kv`:\\[in\\] Valid key-value container. +* `key`:\\[in\\] Lookup key, may or may not exist. +* `dvalue`:\\[in\\] Default value returned if key is not found. +# Returns +If key is not present then **dvalue** is returned, otherwise the value stored under **key**. +### Prototype +```c +void *sc_keyvalue_get_pointer (sc_keyvalue_t * kv, const char *key, void *dvalue); ``` +""" +function sc_keyvalue_get_pointer(kv, key, dvalue) + @ccall libt8.sc_keyvalue_get_pointer(kv::Ptr{sc_keyvalue_t}, key::Cstring, dvalue::Ptr{Cvoid})::Ptr{Cvoid} +end -This code can be called two ways. The first, when `vertex`==NULL and `tree_to_vertex`==NULL, is used to count the number of trees and vertices in the connectivity to be generated by the `.inp` mesh in the *stream*. The second, when `vertices`!=NULL and `tree_to_vertex`!=NULL, fill `vertices` and `tree_to_vertex`. In this case `num_vertices` and `num_trees` need to be set to the maximum number of entries allocated in `vertices` and `tree_to_vertex`. +""" + sc_keyvalue_get_int_check(kv, key, status) + +Query an integer key with error checking. We check whether the key is not found or it is of the wrong type. A default value to be returned on error can be passed in as *status. If status is NULL, then the result on error is undefined. # Arguments -* `stream`:\\[in,out\\] file stream to read the connectivity from -* `num_vertices`:\\[in,out\\] the number of vertices in the connectivity -* `num_trees`:\\[in,out\\] the number of trees in the connectivity -* `vertices`:\\[out\\] the list of `vertices` of the connectivity -* `tree_to_vertex`:\\[out\\] the `tree_to_vertex` map of the connectivity +* `kv`:\\[in\\] Valid key-value table. +* `key`:\\[in\\] Non-NULL key string. +* `status`:\\[in,out\\] If not NULL, set to 0 if there is no error, 1 if the key is not found, 2 if a value is found but its type is not integer, and return the input value *status on error. # Returns -0 if successful and nonzero if not +On error we return *status if status is not NULL, and else an undefined value backed by an assertion. Without error, return the result of the lookup. ### Prototype ```c -int p8est_connectivity_read_inp_stream (FILE * stream, p4est_topidx_t * num_vertices, p4est_topidx_t * num_trees, double *vertices, p4est_topidx_t * tree_to_vertex); +int sc_keyvalue_get_int_check (sc_keyvalue_t * kv, const char *key, int *status); ``` """ -function p8est_connectivity_read_inp_stream(stream, num_vertices, num_trees, vertices, tree_to_vertex) - @ccall libp4est.p8est_connectivity_read_inp_stream(stream::Ptr{Libc.FILE}, num_vertices::Ptr{p4est_topidx_t}, num_trees::Ptr{p4est_topidx_t}, vertices::Ptr{Cdouble}, tree_to_vertex::Ptr{p4est_topidx_t})::Cint +function sc_keyvalue_get_int_check(kv, key, status) + @ccall libt8.sc_keyvalue_get_int_check(kv::Ptr{sc_keyvalue_t}, key::Cstring, status::Ptr{Cint})::Cint end """ - p8est_connectivity_read_inp(filename) - -Create a p4est connectivity from an ABAQUS input file. - -This utility function reads a basic ABAQUS file supporting element type with the prefix C2D4, CPS4, and S4 in 2D and of type C3D8 reading them as bilinear quadrilateral and trilinear hexahedral trees respectively. - -A basic 2D mesh is given below. The `*Node` section gives the vertex number and x, y, and z components for each vertex. The `*Element` section gives the 4 vertices in 2D (8 vertices in 3D) of each element in counter clockwise order. So in 2D the nodes are given as: - -4 3 +-------------------+ | | | | | | | | | | | | +-------------------+ 1 2 - -and in 3D they are given as: - -8 7 +---------------------+ |\\ |\\ | \\ | \\ | \\ | \\ | \\ | \\ | 5+---------------------+6 | | | | +----|----------------+ | 4\\ | 3 \\ | \\ | \\ | \\ | \\ | \\| \\| +---------------------+ 1 2 - -```c++ - *Heading - box.inp - *Node - 1, 5, -5, 5 - 2, 5, 5, 5 - 3, 5, 0, 5 - 4, -5, 5, 5 - 5, 0, 5, 5 - 6, -5, -5, 5 - 7, -5, 0, 5 - 8, 0, -5, 5 - 9, 0, 0, 5 - 10, 5, 5, -5 - 11, 5, -5, -5 - 12, 5, 0, -5 - 13, -5, -5, -5 - 14, 0, -5, -5 - 15, -5, 5, -5 - 16, -5, 0, -5 - 17, 0, 5, -5 - 18, 0, 0, -5 - 19, -5, -5, 0 - 20, 5, -5, 0 - 21, 0, -5, 0 - 22, -5, 5, 0 - 23, -5, 0, 0 - 24, 5, 5, 0 - 25, 0, 5, 0 - 26, 5, 0, 0 - 27, 0, 0, 0 - *Element, type=C3D8, ELSET=EB1 - 1, 6, 19, 23, 7, 8, 21, 27, 9 - 2, 19, 13, 16, 23, 21, 14, 18, 27 - 3, 7, 23, 22, 4, 9, 27, 25, 5 - 4, 23, 16, 15, 22, 27, 18, 17, 25 - 5, 8, 21, 27, 9, 1, 20, 26, 3 - 6, 21, 14, 18, 27, 20, 11, 12, 26 - 7, 9, 27, 25, 5, 3, 26, 24, 2 - 8, 27, 18, 17, 25, 26, 12, 10, 24 -``` + sc_keyvalue_set_int(kv, key, newvalue) -This function reads a mesh from *filename* and returns an associated p4est connectivity. +Routine to set an integer value for a given key. # Arguments -* `filename`:\\[in\\] file to read the connectivity from -# Returns -an allocated connectivity associated with the mesh in *filename* +* `kv`:\\[in\\] Valid key-value table. +* `key`:\\[in\\] Non-NULL key to insert or replace. If it already exists, it must be of type integer. +* `newvalue`:\\[in\\] New value will be stored under key. ### Prototype ```c -p8est_connectivity_t *p8est_connectivity_read_inp (const char *filename); +void sc_keyvalue_set_int (sc_keyvalue_t * kv, const char *key, int newvalue); ``` """ -function p8est_connectivity_read_inp(filename) - @ccall libp4est.p8est_connectivity_read_inp(filename::Cstring)::Ptr{p8est_connectivity_t} +function sc_keyvalue_set_int(kv, key, newvalue) + @ccall libt8.sc_keyvalue_set_int(kv::Ptr{sc_keyvalue_t}, key::Cstring, newvalue::Cint)::Cvoid end """ - t8_cmesh_new_from_p4est(conn, comm, do_partition) + sc_keyvalue_set_double(kv, key, newvalue) + +Routine to set a double value for a given key. +# Arguments +* `kv`:\\[in\\] Valid key-value table. +* `key`:\\[in\\] Non-NULL key to insert or replace. If it already exists, it must be of type double. +* `newvalue`:\\[in\\] New value will be stored under key. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_from_p4est (p4est_connectivity_t *conn, sc_MPI_Comm comm, int do_partition); +void sc_keyvalue_set_double (sc_keyvalue_t * kv, const char *key, double newvalue); ``` """ -function t8_cmesh_new_from_p4est(conn, comm, do_partition) - @ccall libt8.t8_cmesh_new_from_p4est(conn::Ptr{p4est_connectivity_t}, comm::MPI_Comm, do_partition::Cint)::t8_cmesh_t +function sc_keyvalue_set_double(kv, key, newvalue) + @ccall libt8.sc_keyvalue_set_double(kv::Ptr{sc_keyvalue_t}, key::Cstring, newvalue::Cdouble)::Cvoid end """ - t8_cmesh_new_from_p8est(conn, comm, do_partition) + sc_keyvalue_set_string(kv, key, newvalue) +Routine to set a string value for a given key. + +# Arguments +* `kv`:\\[in\\] Valid key-value table. +* `key`:\\[in\\] Non-NULL key to insert or replace. If it already exists, it must be of type string. +* `newvalue`:\\[in\\] New value will be stored under key. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_from_p8est (p8est_connectivity_t *conn, sc_MPI_Comm comm, int do_partition); +void sc_keyvalue_set_string (sc_keyvalue_t * kv, const char *key, const char *newvalue); ``` """ -function t8_cmesh_new_from_p8est(conn, comm, do_partition) - @ccall libt8.t8_cmesh_new_from_p8est(conn::Ptr{p8est_connectivity_t}, comm::MPI_Comm, do_partition::Cint)::t8_cmesh_t +function sc_keyvalue_set_string(kv, key, newvalue) + @ccall libt8.sc_keyvalue_set_string(kv::Ptr{sc_keyvalue_t}, key::Cstring, newvalue::Cstring)::Cvoid end """ - t8_cmesh_new_empty(comm, do_partition, dimension) + sc_keyvalue_set_pointer(kv, key, newvalue) + +Routine to set a pointer value for a given key. +# Arguments +* `kv`:\\[in\\] Valid key-value table. +* `key`:\\[in\\] Non-NULL key to insert or replace. If it already exists, it must be of type pointer. +* `newvalue`:\\[in\\] New value will be stored under key. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_empty (sc_MPI_Comm comm, const int do_partition, const int dimension); +void sc_keyvalue_set_pointer (sc_keyvalue_t * kv, const char *key, void *newvalue); ``` """ -function t8_cmesh_new_empty(comm, do_partition, dimension) - @ccall libt8.t8_cmesh_new_empty(comm::MPI_Comm, do_partition::Cint, dimension::Cint)::t8_cmesh_t +function sc_keyvalue_set_pointer(kv, key, newvalue) + @ccall libt8.sc_keyvalue_set_pointer(kv::Ptr{sc_keyvalue_t}, key::Cstring, newvalue::Ptr{Cvoid})::Cvoid end +# typedef int ( * sc_keyvalue_foreach_t ) ( const char * key , const sc_keyvalue_entry_type_t type , void * entry , const void * u ) """ - t8_cmesh_new_from_class(eclass, comm) +Function to call on every key value pair + +# Arguments +* `key`:\\[in\\] The key for this pair +* `type`:\\[in\\] The type of entry +* `entry`:\\[in\\] Pointer to the entry +* `u`:\\[in\\] Arbitrary user data. +# Returns +Return true if the traversal should continue, false to stop. +""" +const sc_keyvalue_foreach_t = Ptr{Cvoid} + +""" + sc_keyvalue_foreach(kv, fn, user_data) +Iterate through all stored key-value pairs. + +# Arguments +* `kv`:\\[in\\] Valid key-value container. +* `fn`:\\[in\\] Function to call on each key-value pair. +* `user_data`:\\[in,out\\] This pointer is passed through to **fn**. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_from_class (t8_eclass_t eclass, sc_MPI_Comm comm); +void sc_keyvalue_foreach (sc_keyvalue_t * kv, sc_keyvalue_foreach_t fn, void *user_data); ``` """ -function t8_cmesh_new_from_class(eclass, comm) - @ccall libt8.t8_cmesh_new_from_class(eclass::t8_eclass_t, comm::MPI_Comm)::t8_cmesh_t +function sc_keyvalue_foreach(kv, fn, user_data) + @ccall libt8.sc_keyvalue_foreach(kv::Ptr{sc_keyvalue_t}, fn::sc_keyvalue_foreach_t, user_data::Ptr{Cvoid})::Cvoid end """ - t8_cmesh_new_hypercube(eclass, comm, do_bcast, do_partition, periodic) + sc_statinfo + +Store information of one random variable. + +| Field | Note | +| :--------------- | :--------------------------------------- | +| dirty | Only update stats if this is true. | +| count | Inout; global count is 52 bit accurate. | +| sum\\_values | Inout; global sum of values. | +| sum\\_squares | Inout; global sum of squares. | +| min | Inout; minimum over values. | +| max | Inout; maximum over values. | +| variable | Name of the variable for output. | +| variable\\_owned | NULL or deep copy of variable. | +| group | Grouping identifier. | +| prio | Priority identifier. | +""" +struct sc_statinfo + dirty::Cint + count::Clong + sum_values::Cdouble + sum_squares::Cdouble + min::Cdouble + max::Cdouble + min_at_rank::Cint + max_at_rank::Cint + average::Cdouble + variance::Cdouble + standev::Cdouble + variance_mean::Cdouble + standev_mean::Cdouble + variable::Cstring + variable_owned::Cstring + group::Cint + prio::Cint +end + +"""Store information of one random variable.""" +const sc_statinfo_t = sc_statinfo + +struct sc_stats + mpicomm::Cint + kv::Ptr{sc_keyvalue_t} + sarray::Ptr{sc_array_t} +end + +"""The statistics container allows dynamically adding random variables.""" +const sc_statistics_t = sc_stats + +""" + sc_stats_set1(stats, value, variable) + +Populate a [`sc_statinfo_t`](@ref) structure assuming count=1 and mark it dirty. We set sc_stats_group_all and sc_stats_prio_all internally. +# Arguments +* `stats`:\\[out\\] Will be filled with count=1 and the value. +* `value`:\\[in\\] Value used to fill statistics information. +* `variable`:\\[in\\] String to be reported by sc_stats_print. This string is assigned by pointer, not copied. Thus, it must stay alive while stats is in use. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_hypercube (t8_eclass_t eclass, sc_MPI_Comm comm, int do_bcast, int do_partition, int periodic); +void sc_stats_set1 (sc_statinfo_t * stats, double value, const char *variable); ``` """ -function t8_cmesh_new_hypercube(eclass, comm, do_bcast, do_partition, periodic) - @ccall libt8.t8_cmesh_new_hypercube(eclass::t8_eclass_t, comm::MPI_Comm, do_bcast::Cint, do_partition::Cint, periodic::Cint)::t8_cmesh_t +function sc_stats_set1(stats, value, variable) + @ccall libt8.sc_stats_set1(stats::Ptr{sc_statinfo_t}, value::Cdouble, variable::Cstring)::Cvoid end """ - t8_cmesh_new_hypercube_pad(eclass, comm, boundary, polygons_x, polygons_y, polygons_z, use_axis_aligned) + sc_stats_set1_ext(stats, value, variable, copy_variable, stats_group, stats_prio) + +Populate a [`sc_statinfo_t`](@ref) structure assuming count=1 and mark it dirty. +# Arguments +* `stats`:\\[out\\] Will be filled with count=1 and the value. +* `value`:\\[in\\] Value used to fill statistics information. +* `variable`:\\[in\\] String to be reported by sc_stats_print. +* `copy_variable`:\\[in\\] If true, make internal copy of variable. Otherwise just assign the pointer. +* `stats_group`:\\[in\\] Non-negative number or sc_stats_group_all. +* `stats_prio`:\\[in\\] Non-negative number or sc_stats_prio_all. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_hypercube_pad (const t8_eclass_t eclass, sc_MPI_Comm comm, const double *boundary, t8_locidx_t polygons_x, t8_locidx_t polygons_y, t8_locidx_t polygons_z, const int use_axis_aligned); +void sc_stats_set1_ext (sc_statinfo_t * stats, double value, const char *variable, int copy_variable, int stats_group, int stats_prio); ``` """ -function t8_cmesh_new_hypercube_pad(eclass, comm, boundary, polygons_x, polygons_y, polygons_z, use_axis_aligned) - @ccall libt8.t8_cmesh_new_hypercube_pad(eclass::t8_eclass_t, comm::MPI_Comm, boundary::Ptr{Cdouble}, polygons_x::t8_locidx_t, polygons_y::t8_locidx_t, polygons_z::t8_locidx_t, use_axis_aligned::Cint)::t8_cmesh_t +function sc_stats_set1_ext(stats, value, variable, copy_variable, stats_group, stats_prio) + @ccall libt8.sc_stats_set1_ext(stats::Ptr{sc_statinfo_t}, value::Cdouble, variable::Cstring, copy_variable::Cint, stats_group::Cint, stats_prio::Cint)::Cvoid end """ - t8_cmesh_new_hypercube_pad_ext(eclass, comm, boundary, polygons_x, polygons_y, polygons_z, periodic_x, periodic_y, periodic_z, use_axis_aligned, set_partition, offset) + sc_stats_init(stats, variable) + +Initialize a [`sc_statinfo_t`](@ref) structure assuming count=0 and mark it dirty. This is useful if *stats* will be used to sc_stats_accumulate instances locally before global statistics are computed. We set sc_stats_group_all and sc_stats_prio_all internally. +# Arguments +* `stats`:\\[out\\] Will be filled with count 0 and values of 0. +* `variable`:\\[in\\] String to be reported by sc_stats_print. This string is assigned by pointer, not copied. Thus, it must stay alive while stats is in use. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_hypercube_pad_ext (const t8_eclass_t eclass, sc_MPI_Comm comm, const double *boundary, t8_locidx_t polygons_x, t8_locidx_t polygons_y, t8_locidx_t polygons_z, const int periodic_x, const int periodic_y, const int periodic_z, const int use_axis_aligned, const int set_partition, t8_gloidx_t offset); +void sc_stats_init (sc_statinfo_t * stats, const char *variable); ``` """ -function t8_cmesh_new_hypercube_pad_ext(eclass, comm, boundary, polygons_x, polygons_y, polygons_z, periodic_x, periodic_y, periodic_z, use_axis_aligned, set_partition, offset) - @ccall libt8.t8_cmesh_new_hypercube_pad_ext(eclass::t8_eclass_t, comm::MPI_Comm, boundary::Ptr{Cdouble}, polygons_x::t8_locidx_t, polygons_y::t8_locidx_t, polygons_z::t8_locidx_t, periodic_x::Cint, periodic_y::Cint, periodic_z::Cint, use_axis_aligned::Cint, set_partition::Cint, offset::t8_gloidx_t)::t8_cmesh_t +function sc_stats_init(stats, variable) + @ccall libt8.sc_stats_init(stats::Ptr{sc_statinfo_t}, variable::Cstring)::Cvoid end """ - t8_cmesh_new_hypercube_hybrid(comm, do_partition, periodic) + sc_stats_init_ext(stats, variable, copy_variable, stats_group, stats_prio) + +Initialize a [`sc_statinfo_t`](@ref) structure assuming count=0 and mark it dirty. This is useful if *stats* will be used to sc_stats_accumulate instances locally before global statistics are computed. +# Arguments +* `stats`:\\[out\\] Will be filled with count 0 and values of 0. +* `variable`:\\[in\\] String to be reported by sc_stats_print. +* `copy_variable`:\\[in\\] If true, make internal copy of variable. Otherwise just assign the pointer. +* `stats_group`:\\[in\\] Non-negative number or sc_stats_group_all. +* `stats_prio`:\\[in\\] Non-negative number or sc_stats_prio_all. Values increase by importance. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_hypercube_hybrid (sc_MPI_Comm comm, int do_partition, int periodic); +void sc_stats_init_ext (sc_statinfo_t * stats, const char *variable, int copy_variable, int stats_group, int stats_prio); ``` """ -function t8_cmesh_new_hypercube_hybrid(comm, do_partition, periodic) - @ccall libt8.t8_cmesh_new_hypercube_hybrid(comm::MPI_Comm, do_partition::Cint, periodic::Cint)::t8_cmesh_t +function sc_stats_init_ext(stats, variable, copy_variable, stats_group, stats_prio) + @ccall libt8.sc_stats_init_ext(stats::Ptr{sc_statinfo_t}, variable::Cstring, copy_variable::Cint, stats_group::Cint, stats_prio::Cint)::Cvoid end """ - t8_cmesh_new_periodic(comm, dim) + sc_stats_reset(stats, reset_vgp) + +Reset all values to zero, optionally unassign name, group, and priority. +# Arguments +* `stats`:\\[in,out\\] Variables are zeroed. They can be set again by set1 or accumulate. +* `reset_vgp`:\\[in\\] If true, the variable name string is zeroed and if we did a copy, the copy is freed. If true, group and priority are set to all. If false, we don't touch any of the above. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_periodic (sc_MPI_Comm comm, int dim); +void sc_stats_reset (sc_statinfo_t * stats, int reset_vgp); ``` """ -function t8_cmesh_new_periodic(comm, dim) - @ccall libt8.t8_cmesh_new_periodic(comm::MPI_Comm, dim::Cint)::t8_cmesh_t +function sc_stats_reset(stats, reset_vgp) + @ccall libt8.sc_stats_reset(stats::Ptr{sc_statinfo_t}, reset_vgp::Cint)::Cvoid end """ - t8_cmesh_new_periodic_tri(comm) + sc_stats_set_group_prio(stats, stats_group, stats_prio) + +Set/update the group and priority information for a stats item. +# Arguments +* `stats`:\\[out\\] Only group and stats entries are updated. +* `stats_group`:\\[in\\] Non-negative number or sc_stats_group_all. +* `stats_prio`:\\[in\\] Non-negative number or sc_stats_prio_all. Values increase by importance. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_periodic_tri (sc_MPI_Comm comm); +void sc_stats_set_group_prio (sc_statinfo_t * stats, int stats_group, int stats_prio); ``` """ -function t8_cmesh_new_periodic_tri(comm) - @ccall libt8.t8_cmesh_new_periodic_tri(comm::MPI_Comm)::t8_cmesh_t +function sc_stats_set_group_prio(stats, stats_group, stats_prio) + @ccall libt8.sc_stats_set_group_prio(stats::Ptr{sc_statinfo_t}, stats_group::Cint, stats_prio::Cint)::Cvoid end """ - t8_cmesh_new_periodic_hybrid(comm) + sc_stats_accumulate(stats, value) + +Add an instance of the random variable. The counter of the variable is increased by one. The value is added into the present values of the variable. +# Arguments +* `stats`:\\[out\\] Must be dirty. We bump count and values. +* `value`:\\[in\\] Value used to update statistics information. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_periodic_hybrid (sc_MPI_Comm comm); +void sc_stats_accumulate (sc_statinfo_t * stats, double value); ``` """ -function t8_cmesh_new_periodic_hybrid(comm) - @ccall libt8.t8_cmesh_new_periodic_hybrid(comm::MPI_Comm)::t8_cmesh_t +function sc_stats_accumulate(stats, value) + @ccall libt8.sc_stats_accumulate(stats::Ptr{sc_statinfo_t}, value::Cdouble)::Cvoid end """ - t8_cmesh_new_periodic_line_more_trees(comm) + sc_stats_compute(mpicomm, nvars, stats) ### Prototype ```c -t8_cmesh_t t8_cmesh_new_periodic_line_more_trees (sc_MPI_Comm comm); +void sc_stats_compute (sc_MPI_Comm mpicomm, int nvars, sc_statinfo_t * stats); ``` """ -function t8_cmesh_new_periodic_line_more_trees(comm) - @ccall libt8.t8_cmesh_new_periodic_line_more_trees(comm::MPI_Comm)::t8_cmesh_t +function sc_stats_compute(mpicomm, nvars, stats) + @ccall libt8.sc_stats_compute(mpicomm::Cint, nvars::Cint, stats::Ptr{sc_statinfo_t})::Cvoid end """ - t8_cmesh_new_bigmesh(eclass, num_trees, comm) + sc_stats_compute1(mpicomm, nvars, stats) ### Prototype ```c -t8_cmesh_t t8_cmesh_new_bigmesh (t8_eclass_t eclass, int num_trees, sc_MPI_Comm comm); +void sc_stats_compute1 (sc_MPI_Comm mpicomm, int nvars, sc_statinfo_t * stats); ``` """ -function t8_cmesh_new_bigmesh(eclass, num_trees, comm) - @ccall libt8.t8_cmesh_new_bigmesh(eclass::t8_eclass_t, num_trees::Cint, comm::MPI_Comm)::t8_cmesh_t +function sc_stats_compute1(mpicomm, nvars, stats) + @ccall libt8.sc_stats_compute1(mpicomm::Cint, nvars::Cint, stats::Ptr{sc_statinfo_t})::Cvoid end """ - t8_cmesh_new_line_zigzag(comm) + sc_stats_print(package_id, log_priority, nvars, stats, full, summary) + +Print measured statistics. This function uses the [`SC_LC_GLOBAL`](@ref) log category. That means the default action is to print only on rank 0. Applications can change that by providing a user-defined log handler. All groups and priorities are printed. +# Arguments +* `package_id`:\\[in\\] Registered package id or -1. +* `log_priority`:\\[in\\] Log priority for output according to sc.h. +* `nvars`:\\[in\\] Number of stats items in input array. +* `stats`:\\[in\\] Input array of stats variable items. +* `full`:\\[in\\] Print full information for every variable. +* `summary`:\\[in\\] Print summary information all on 1 line. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_line_zigzag (sc_MPI_Comm comm); +void sc_stats_print (int package_id, int log_priority, int nvars, sc_statinfo_t * stats, int full, int summary); ``` """ -function t8_cmesh_new_line_zigzag(comm) - @ccall libt8.t8_cmesh_new_line_zigzag(comm::MPI_Comm)::t8_cmesh_t +function sc_stats_print(package_id, log_priority, nvars, stats, full, summary) + @ccall libt8.sc_stats_print(package_id::Cint, log_priority::Cint, nvars::Cint, stats::Ptr{sc_statinfo_t}, full::Cint, summary::Cint)::Cvoid end """ - t8_cmesh_new_prism_cake(comm, num_of_prisms) + sc_stats_print_ext(package_id, log_priority, nvars, stats, stats_group, stats_prio, full, summary) + +Print measured statistics, filter by group and/or priority. This function uses the [`SC_LC_GLOBAL`](@ref) log category. That means the default action is to print only on rank 0. Applications can change that by providing a user-defined log handler. +# Arguments +* `package_id`:\\[in\\] Registered package id or -1. +* `log_priority`:\\[in\\] Log priority for output according to sc.h. +* `nvars`:\\[in\\] Number of stats items in input array. +* `stats`:\\[in\\] Input array of stats variable items. +* `stats_group`:\\[in\\] Print only this group. Non-negative or sc_stats_group_all. We skip printing a variable if neither this parameter nor the item's group is all and if the item's group does not match this. +* `stats_prio`:\\[in\\] Print this and higher priorities. Non-negative or sc_stats_prio_all. We skip printing a variable if neither this parameter nor the item's prio is all and if the item's prio is less than this. +* `full`:\\[in\\] Print full information for every variable. This produces multiple lines including minimum, maximum, and standard deviation. If this is false, print one line per variable. +* `summary`:\\[in\\] Print summary information all on 1 line. This always contains all variables. Not affected by stats\\_group and stats\\_prio. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_prism_cake (sc_MPI_Comm comm, int num_of_prisms); +void sc_stats_print_ext (int package_id, int log_priority, int nvars, sc_statinfo_t * stats, int stats_group, int stats_prio, int full, int summary); ``` """ -function t8_cmesh_new_prism_cake(comm, num_of_prisms) - @ccall libt8.t8_cmesh_new_prism_cake(comm::MPI_Comm, num_of_prisms::Cint)::t8_cmesh_t +function sc_stats_print_ext(package_id, log_priority, nvars, stats, stats_group, stats_prio, full, summary) + @ccall libt8.sc_stats_print_ext(package_id::Cint, log_priority::Cint, nvars::Cint, stats::Ptr{sc_statinfo_t}, stats_group::Cint, stats_prio::Cint, full::Cint, summary::Cint)::Cvoid end """ - t8_cmesh_new_prism_deformed(comm) + sc_statistics_new(mpicomm) ### Prototype ```c -t8_cmesh_t t8_cmesh_new_prism_deformed (sc_MPI_Comm comm); +sc_statistics_t *sc_statistics_new (sc_MPI_Comm mpicomm); ``` """ -function t8_cmesh_new_prism_deformed(comm) - @ccall libt8.t8_cmesh_new_prism_deformed(comm::MPI_Comm)::t8_cmesh_t +function sc_statistics_new(mpicomm) + @ccall libt8.sc_statistics_new(mpicomm::Cint)::Ptr{sc_statistics_t} end """ - t8_cmesh_new_pyramid_deformed(comm) + sc_statistics_destroy(stats) + +Destroy a statistics structure. +# Arguments +* `stats`:\\[in,out\\] Valid object is invalidated. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_pyramid_deformed (sc_MPI_Comm comm); +void sc_statistics_destroy (sc_statistics_t * stats); ``` """ -function t8_cmesh_new_pyramid_deformed(comm) - @ccall libt8.t8_cmesh_new_pyramid_deformed(comm::MPI_Comm)::t8_cmesh_t +function sc_statistics_destroy(stats) + @ccall libt8.sc_statistics_destroy(stats::Ptr{sc_statistics_t})::Cvoid end """ - t8_cmesh_new_prism_cake_funny_oriented(comm) + sc_statistics_add(stats, name) + +Register a statistics variable by name and set its value to 0. This variable must not exist already. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_prism_cake_funny_oriented (sc_MPI_Comm comm); +void sc_statistics_add (sc_statistics_t * stats, const char *name); ``` """ -function t8_cmesh_new_prism_cake_funny_oriented(comm) - @ccall libt8.t8_cmesh_new_prism_cake_funny_oriented(comm::MPI_Comm)::t8_cmesh_t +function sc_statistics_add(stats, name) + @ccall libt8.sc_statistics_add(stats::Ptr{sc_statistics_t}, name::Cstring)::Cvoid end """ - t8_cmesh_new_prism_geometry(comm) + sc_statistics_add_empty(stats, name) + +Register a statistics variable by name and set its count to 0. This variable must not exist already. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_prism_geometry (sc_MPI_Comm comm); +void sc_statistics_add_empty (sc_statistics_t * stats, const char *name); ``` """ -function t8_cmesh_new_prism_geometry(comm) - @ccall libt8.t8_cmesh_new_prism_geometry(comm::MPI_Comm)::t8_cmesh_t +function sc_statistics_add_empty(stats, name) + @ccall libt8.sc_statistics_add_empty(stats::Ptr{sc_statistics_t}, name::Cstring)::Cvoid end """ - t8_cmesh_new_brick_2d(num_x, num_y, x_periodic, y_periodic, comm) + sc_statistics_has(stats, name) + +Returns true if the stats include a variable with the given name ### Prototype ```c -t8_cmesh_t t8_cmesh_new_brick_2d (t8_gloidx_t num_x, t8_gloidx_t num_y, int x_periodic, int y_periodic, sc_MPI_Comm comm); +int sc_statistics_has (sc_statistics_t * stats, const char *name); ``` """ -function t8_cmesh_new_brick_2d(num_x, num_y, x_periodic, y_periodic, comm) - @ccall libt8.t8_cmesh_new_brick_2d(num_x::t8_gloidx_t, num_y::t8_gloidx_t, x_periodic::Cint, y_periodic::Cint, comm::MPI_Comm)::t8_cmesh_t +function sc_statistics_has(stats, name) + @ccall libt8.sc_statistics_has(stats::Ptr{sc_statistics_t}, name::Cstring)::Cint end """ - t8_cmesh_new_brick_3d(num_x, num_y, num_z, x_periodic, y_periodic, z_periodic, comm) + sc_statistics_set(stats, name, value) + +Set the value of a statistics variable, see [`sc_stats_set1`](@ref). The variable must previously be added with [`sc_statistics_add`](@ref). This assumes count=1 as in the [`sc_stats_set1`](@ref) function above. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_brick_3d (t8_gloidx_t num_x, t8_gloidx_t num_y, t8_gloidx_t num_z, int x_periodic, int y_periodic, int z_periodic, sc_MPI_Comm comm); +void sc_statistics_set (sc_statistics_t * stats, const char *name, double value); ``` """ -function t8_cmesh_new_brick_3d(num_x, num_y, num_z, x_periodic, y_periodic, z_periodic, comm) - @ccall libt8.t8_cmesh_new_brick_3d(num_x::t8_gloidx_t, num_y::t8_gloidx_t, num_z::t8_gloidx_t, x_periodic::Cint, y_periodic::Cint, z_periodic::Cint, comm::MPI_Comm)::t8_cmesh_t +function sc_statistics_set(stats, name, value) + @ccall libt8.sc_statistics_set(stats::Ptr{sc_statistics_t}, name::Cstring, value::Cdouble)::Cvoid end """ - t8_cmesh_new_disjoint_bricks(num_x, num_y, num_z, x_periodic, y_periodic, z_periodic, comm) + sc_statistics_accumulate(stats, name, value) + +Add an instance of a statistics variable, see [`sc_stats_accumulate`](@ref) The variable must previously be added with [`sc_statistics_add_empty`](@ref). ### Prototype ```c -t8_cmesh_t t8_cmesh_new_disjoint_bricks (t8_gloidx_t num_x, t8_gloidx_t num_y, t8_gloidx_t num_z, int x_periodic, int y_periodic, int z_periodic, sc_MPI_Comm comm); +void sc_statistics_accumulate (sc_statistics_t * stats, const char *name, double value); ``` """ -function t8_cmesh_new_disjoint_bricks(num_x, num_y, num_z, x_periodic, y_periodic, z_periodic, comm) - @ccall libt8.t8_cmesh_new_disjoint_bricks(num_x::t8_gloidx_t, num_y::t8_gloidx_t, num_z::t8_gloidx_t, x_periodic::Cint, y_periodic::Cint, z_periodic::Cint, comm::MPI_Comm)::t8_cmesh_t +function sc_statistics_accumulate(stats, name, value) + @ccall libt8.sc_statistics_accumulate(stats::Ptr{sc_statistics_t}, name::Cstring, value::Cdouble)::Cvoid end """ - t8_cmesh_new_tet_orientation_test(comm) + sc_statistics_compute(stats) + +Compute statistics for all variables, see [`sc_stats_compute`](@ref). ### Prototype ```c -t8_cmesh_t t8_cmesh_new_tet_orientation_test (sc_MPI_Comm comm); +void sc_statistics_compute (sc_statistics_t * stats); ``` """ -function t8_cmesh_new_tet_orientation_test(comm) - @ccall libt8.t8_cmesh_new_tet_orientation_test(comm::MPI_Comm)::t8_cmesh_t +function sc_statistics_compute(stats) + @ccall libt8.sc_statistics_compute(stats::Ptr{sc_statistics_t})::Cvoid end """ - t8_cmesh_new_hybrid_gate(comm) + sc_statistics_print(stats, package_id, log_priority, full, summary) + +Print all statistics variables, see [`sc_stats_print`](@ref). ### Prototype ```c -t8_cmesh_t t8_cmesh_new_hybrid_gate (sc_MPI_Comm comm); +void sc_statistics_print (sc_statistics_t * stats, int package_id, int log_priority, int full, int summary); ``` """ -function t8_cmesh_new_hybrid_gate(comm) - @ccall libt8.t8_cmesh_new_hybrid_gate(comm::MPI_Comm)::t8_cmesh_t +function sc_statistics_print(stats, package_id, log_priority, full, summary) + @ccall libt8.sc_statistics_print(stats::Ptr{sc_statistics_t}, package_id::Cint, log_priority::Cint, full::Cint, summary::Cint)::Cvoid end """ - t8_cmesh_new_hybrid_gate_deformed(comm) + t8_forest -### Prototype -```c -t8_cmesh_t t8_cmesh_new_hybrid_gate_deformed (sc_MPI_Comm comm); -``` -""" -function t8_cmesh_new_hybrid_gate_deformed(comm) - @ccall libt8.t8_cmesh_new_hybrid_gate_deformed(comm::MPI_Comm)::t8_cmesh_t +| Field | Note | +| :----------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| rc | Reference counter. | +| set\\_level | Level to use in new construction. | +| set\\_for\\_coarsening | Change partition to allow for one round of coarsening | +| cmesh | Coarse mesh to use. | +| scheme | Scheme for element types. | +| maxlevel | The maximum allowed refinement level for elements in this forest. | +| maxlevel\\_existing | If >= 0, the maximum occurring refinemnent level of a forest element. | +| do\\_dup | Communicator shall be duped. | +| dimension | Dimension inferred from **cmesh**. | +| incomplete\\_trees | Flag to check whether the forest has (potential) incomplete trees. A tree is incomplete if an element has been removed from it. Once an element got removed, the flag sets to 1 (true) and stays. For a committed forest this flag is either true on all ranks or false on all ranks. | +| set\\_from | Temporarily store source forest. | +| from\\_method | Method to derive from **set_from**. | +| set\\_adapt\\_fn | refinement and coarsen function. Called when **from_method** is set to [`T8_FOREST_FROM_ADAPT`](@ref). | +| set\\_adapt\\_recursive | Flag to decide whether coarsen and refine are carried out recursive | +| set\\_balance | Flag to decide whether to forest will be balance in t8_forest_commit. See t8_forest_set_balance. If 0, no balance. If 1 balance with repartitioning, if 2 balance without repartitioning, # See also t8\\_forest\\_balance | +| do\\_ghost | If True, a ghost layer will be created when the forest is committed. | +| ghost\\_type | If a ghost layer will be created, the type of neighbors that count as ghost. | +| ghost\\_algorithm | Controls the algorithm used for ghost. 1 = balanced only. 2 = also unbalanced 3 = top-down search and unbalanced. | +| user\\_data | Pointer for arbitrary user data. # See also [`t8_forest_set_user_data`](@ref). | +| user\\_function | Pointer for arbitrary user function. # See also [`t8_forest_set_user_function`](@ref). | +| t8code\\_data | Pointer for arbitrary data that is used internally. | +| committed | t8_forest_commit called? | +| mpisize | Number of MPI processes. | +| mpirank | Number of this MPI process. | +| first\\_local\\_tree | The global index of the first local tree on this process. If first\\_local\\_tree is larger than last\\_local\\_tree then this processor/forest is empty. See https://github.com/DLR-AMR/t8code/wiki/Tree-indexing | +| last\\_local\\_tree | The global index of the last local tree on this process. -1 if this processor is empty. | +| global\\_num\\_trees | The total number of global trees. | +| trees | The array of trees. | +| ghosts | If not NULL, the ghost elements. # See also [`t8_forest_ghost`](@ref).h | +| element\\_offsets | If partitioned, for each process the global index of its first element. Since it is memory consuming, it is usually only constructed when needed and otherwise unallocated. | +| global\\_first\\_desc | If partitioned, for each process the linear id (at maxlevel) of its first element's first descendant. t8_element_set_linear_id. Stores 0 for empty processes. Since it is memory consuming, it is usually only constructed when needed and otherwise unallocated. | +| tree\\_offsets | If partitioned for each process the global index of its first local tree or -(first local tree) - 1 if the first tree on that process is shared. Since this is memory consuming we only construct it when needed. This array follows the same logic as *tree_offsets* in [`t8_cmesh_t`](@ref) | +| local\\_num\\_leaf\\_elements | Number of leaf elements on this processor. | +| global\\_num\\_leaf\\_elements | Number of leaf elements on all processors. | +| profile | If not NULL, runtimes and statistics about forest\\_commit are stored here. | +| stats | The SC profiling stats of the forest. | +| stats\\_computed | Switch indicating whether the profiling stats have been compute (1) or not (0) | +""" +struct t8_forest + rc::t8_refcount_t + set_level::Cint + set_for_coarsening::Cint + mpicomm::Cint + cmesh::t8_cmesh_t + scheme::Ptr{t8_scheme_c} + maxlevel::Cint + maxlevel_existing::Cint + do_dup::Cint + dimension::Cint + incomplete_trees::Cint + set_from::t8_forest_t + from_method::t8_forest_from_t + set_adapt_fn::t8_forest_adapt_t + set_adapt_recursive::Cint + set_balance::Cint + do_ghost::Cint + ghost_type::t8_ghost_type_t + ghost_algorithm::Cint + user_data::Ptr{Cvoid} + user_function::Ptr{Cvoid} + t8code_data::Ptr{Cvoid} + committed::Cint + mpisize::Cint + mpirank::Cint + first_local_tree::t8_gloidx_t + last_local_tree::t8_gloidx_t + global_num_trees::t8_gloidx_t + trees::Ptr{sc_array_t} + ghosts::t8_forest_ghost_t + element_offsets::t8_shmem_array_t + global_first_desc::t8_shmem_array_t + tree_offsets::t8_shmem_array_t + local_num_leaf_elements::t8_locidx_t + global_num_leaf_elements::t8_gloidx_t + profile::Ptr{t8_profile_t} + stats::NTuple{17, sc_statinfo_t} + stats_computed::Cint end +"""Opaque pointer to a forest implementation.""" +const t8_forest_t = Ptr{t8_forest} + """ - t8_cmesh_new_full_hybrid(comm) + t8_forest_adapt(forest) +Adapt a forest. + +# Arguments +* `forest`:\\[in,out\\] The forest to be adapted ### Prototype ```c -t8_cmesh_t t8_cmesh_new_full_hybrid (sc_MPI_Comm comm); +void t8_forest_adapt (t8_forest_t forest); ``` """ -function t8_cmesh_new_full_hybrid(comm) - @ccall libt8.t8_cmesh_new_full_hybrid(comm::MPI_Comm)::t8_cmesh_t +function t8_forest_adapt(forest) + @ccall libt8.t8_forest_adapt(forest::t8_forest_t)::Cvoid end """ - t8_cmesh_new_pyramid_cake(comm, num_of_pyra) + t8_tree -### Prototype -```c -t8_cmesh_t t8_cmesh_new_pyramid_cake (sc_MPI_Comm comm, int num_of_pyra); -``` +The t8 tree datatype + +| Field | Note | +| :---------------- | :----------------------------------------------------------------- | +| leaf\\_elements | locally stored leaf elements | +| eclass | The element class of this tree | +| first\\_desc | first local descendant | +| last\\_desc | last local descendant | +| elements\\_offset | cumulative sum over earlier trees on this processor (locals only) | """ -function t8_cmesh_new_pyramid_cake(comm, num_of_pyra) - @ccall libt8.t8_cmesh_new_pyramid_cake(comm::MPI_Comm, num_of_pyra::Cint)::t8_cmesh_t +struct t8_tree + leaf_elements::t8_element_array_t + eclass::t8_eclass_t + first_desc::Ptr{t8_element_t} + last_desc::Ptr{t8_element_t} + elements_offset::t8_locidx_t end +"""Opaque pointer to a tree implementation.""" +const t8_tree_t = Ptr{t8_tree} + """ - t8_cmesh_new_long_brick_pyramid(comm, num_cubes) + t8_ghost_type_t -### Prototype -```c -t8_cmesh_t t8_cmesh_new_long_brick_pyramid (sc_MPI_Comm comm, int num_cubes); -``` +This type controls, which neighbors count as ghost elements. Currently, we support face-neighbors. Vertex and edge neighbors will eventually be added. + +| Enumerator | Note | +| :-------------------- | :---------------------------------------------------------------- | +| T8\\_GHOST\\_NONE | Do not create ghost layer. | +| T8\\_GHOST\\_FACES | Consider all face (codimension 1) neighbors. | +| T8\\_GHOST\\_EDGES | Consider all edge (codimension 2) and face neighbors. | +| T8\\_GHOST\\_VERTICES | Consider all vertex (codimension 3) and edge and face neighbors. | """ -function t8_cmesh_new_long_brick_pyramid(comm, num_cubes) - @ccall libt8.t8_cmesh_new_long_brick_pyramid(comm::MPI_Comm, num_cubes::Cint)::t8_cmesh_t +@cenum t8_ghost_type_t::UInt32 begin + T8_GHOST_NONE = 0 + T8_GHOST_FACES = 1 + T8_GHOST_EDGES = 2 + T8_GHOST_VERTICES = 3 end +# typedef void ( * t8_generic_function_pointer ) ( void ) """ - t8_cmesh_new_row_of_cubes(num_trees, set_attributes, do_partition, comm) +This typedef is needed as a helper construct to properly be able to define a function that returns a pointer to a void fun(void) function. -### Prototype -```c -t8_cmesh_t t8_cmesh_new_row_of_cubes (t8_locidx_t num_trees, const int set_attributes, const int do_partition, sc_MPI_Comm comm); -``` +# See also +[`t8_forest_get_user_function`](@ref). """ -function t8_cmesh_new_row_of_cubes(num_trees, set_attributes, do_partition, comm) - @ccall libt8.t8_cmesh_new_row_of_cubes(num_trees::t8_locidx_t, set_attributes::Cint, do_partition::Cint, comm::MPI_Comm)::t8_cmesh_t -end +const t8_generic_function_pointer = Ptr{Cvoid} +# typedef void ( * t8_forest_replace_t ) ( t8_forest_t forest_old , t8_forest_t forest_new , t8_locidx_t which_tree , const t8_eclass_t tree_class , const t8_scheme_c * scheme , const int refine , const int num_outgoing , const t8_locidx_t first_outgoing , const int num_incoming , const t8_locidx_t first_incoming ) """ - t8_cmesh_new_quadrangulated_disk(radius, comm) +Callback function prototype to replace one set of elements with another. -### Prototype -```c -t8_cmesh_t t8_cmesh_new_quadrangulated_disk (const double radius, sc_MPI_Comm comm); -``` +This is used by the replace routine which can be called after adapt, when the elements of an existing, valid forest are changed. The callback allows the user to make changes to the elements of the new forest that are either refined, coarsened or the same as elements in the old forest. + +If an element is being refined, *refine* and *num_outgoing* will be 1 and *num_incoming* will be the number of children. If a family is being coarsened, *refine* will be -1, *num_outgoing* will be the number of family members and *num_incoming* will be 1. If an element is being removed, *refine* and *num_outgoing* will be 1 and *num_incoming* will be 0. Else *refine* will be 0 and *num_outgoing* and *num_incoming* will both be 1. + +# Arguments +* `forest_old`:\\[in\\] The forest that is adapted +* `forest_new`:\\[in,out\\] The forest that is newly constructed from *forest_old* +* `which_tree`:\\[in\\] The local tree containing *first_outgoing* and *first_incoming* +* `tree_class`:\\[in\\] The eclass of the local tree containing *first_outgoing* and *first_incoming* +* `scheme`:\\[in\\] The scheme of the forest +* `refine`:\\[in\\] -1 if family in *forest_old* got coarsened, 0 if element has not been touched, 1 if element got refined and -2 if element got removed. See return of [`t8_forest_adapt_t`](@ref). +* `num_outgoing`:\\[in\\] The number of outgoing elements. +* `first_outgoing`:\\[in\\] The tree local index of the first outgoing element. 0 <= first\\_outgoing < which\\_tree->num\\_elements +* `num_incoming`:\\[in\\] The number of incoming elements. +* `first_incoming`:\\[in\\] The tree local index of the first incoming element. 0 <= first\\_incom < new\\_which\\_tree->num\\_elements +# See also +[`t8_forest_iterate_replace`](@ref) """ -function t8_cmesh_new_quadrangulated_disk(radius, comm) - @ccall libt8.t8_cmesh_new_quadrangulated_disk(radius::Cdouble, comm::MPI_Comm)::t8_cmesh_t -end +const t8_forest_replace_t = Ptr{Cvoid} + +# typedef int ( * t8_forest_adapt_t ) ( t8_forest_t forest , t8_forest_t forest_from , t8_locidx_t which_tree , const t8_eclass_t tree_class , t8_locidx_t lelement_id , const t8_scheme_c * scheme , const int is_family , const int num_elements , t8_element_t * elements [ ] ) +""" +Callback function prototype to decide for refining and coarsening. If *is_family* equals 1, the first *num_elements* in *elements* form a family and we decide whether this family should be coarsened or only the first element should be refined. Otherwise *is_family* must equal zero and we consider the first entry of the element array for refinement. Entries of the element array beyond the first *num_elements* are undefined. + +# Arguments +* `forest`:\\[in\\] The forest to which the new elements belong. +* `forest_from`:\\[in\\] The forest that is adapted. +* `which_tree`:\\[in\\] The local tree containing *elements*. +* `tree_class`:\\[in\\] The eclass of *which_tree*. +* `lelement_id`:\\[in\\] The local element id in *forest_old* in the tree of the current element. +* `scheme`:\\[in\\] The scheme of the forest. +* `is_family`:\\[in\\] If 1, the first *num_elements* entries in *elements* form a family. If 0, they do not. +* `num_elements`:\\[in\\] The number of entries in *elements* that are defined +* `elements`:\\[in\\] Pointers to a family or, if *is_family* is zero, pointer to one element. +# Returns +1 if the first entry in *elements* should be refined, -1 if the family *elements* shall be coarsened, -2 if the first entry in *elements* should be removed, 0 else. +""" +const t8_forest_adapt_t = Ptr{Cvoid} + +""" + t8_forest_init(pforest) -""" - t8_cmesh_new_triangulated_spherical_surface_octahedron(radius, comm) +Create a new forest with reference count one. This forest needs to be specialized with the t8\\_forest\\_set\\_* calls. Currently it is mandatory to either call the functions + +# Arguments +* `pforest`:\\[in,out\\] On input, this pointer must be non-NULL. On return, this pointer set to the new forest. +# See also +t8\\_forest\\_set\\_mpicomm, t8_forest_set_cmesh, and t8_forest_set_scheme, or to call one of t8_forest_set_copy, t8_forest_set_adapt, or t8_forest_set_partition. It is illegal to mix these calls, or to call more than one of the three latter functions Then it needs to be set up with t8_forest_commit. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_triangulated_spherical_surface_octahedron (const double radius, sc_MPI_Comm comm); +void t8_forest_init (t8_forest_t *pforest); ``` """ -function t8_cmesh_new_triangulated_spherical_surface_octahedron(radius, comm) - @ccall libt8.t8_cmesh_new_triangulated_spherical_surface_octahedron(radius::Cdouble, comm::MPI_Comm)::t8_cmesh_t +function t8_forest_init(pforest) + @ccall libt8.t8_forest_init(pforest::Ptr{t8_forest_t})::Cvoid end """ - t8_cmesh_new_triangulated_spherical_surface_icosahedron(radius, comm) + t8_forest_is_initialized(forest) + +Check whether a forest is not NULL, initialized and not committed. In addition, it asserts that the forest is consistent as much as possible. +# Arguments +* `forest`:\\[in\\] This forest is examined. May be NULL. +# Returns +True if forest is not NULL, t8_forest_init has been called on it, but not t8_forest_commit. False otherwise. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_triangulated_spherical_surface_icosahedron (const double radius, sc_MPI_Comm comm); +int t8_forest_is_initialized (t8_forest_t forest); ``` """ -function t8_cmesh_new_triangulated_spherical_surface_icosahedron(radius, comm) - @ccall libt8.t8_cmesh_new_triangulated_spherical_surface_icosahedron(radius::Cdouble, comm::MPI_Comm)::t8_cmesh_t +function t8_forest_is_initialized(forest) + @ccall libt8.t8_forest_is_initialized(forest::t8_forest_t)::Cint end """ - t8_cmesh_new_triangulated_spherical_surface_cube(radius, comm) + t8_forest_is_committed(forest) + +Check whether a forest is not NULL, initialized and committed. In addition, it asserts that the forest is consistent as much as possible. +# Arguments +* `forest`:\\[in\\] This forest is examined. May be NULL. +# Returns +True if forest is not NULL and t8_forest_init has been called on it as well as t8_forest_commit. False otherwise. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_triangulated_spherical_surface_cube (const double radius, sc_MPI_Comm comm); +int t8_forest_is_committed (t8_forest_t forest); ``` """ -function t8_cmesh_new_triangulated_spherical_surface_cube(radius, comm) - @ccall libt8.t8_cmesh_new_triangulated_spherical_surface_cube(radius::Cdouble, comm::MPI_Comm)::t8_cmesh_t +function t8_forest_is_committed(forest) + @ccall libt8.t8_forest_is_committed(forest::t8_forest_t)::Cint end """ - t8_cmesh_new_quadrangulated_spherical_surface(radius, comm) + t8_forest_no_overlap(forest) + +Check whether the forest has local overlapping elements. + +!!! note + + This function is collective, but only checks local overlapping on each process. + +# Arguments +* `forest`:\\[in\\] The forest to consider. +# Returns +True if *forest* has no elements which are inside each other. +# See also +[`t8_forest_partition_test_boundary_element`](@ref) if you also want to test for global overlap across the process boundaries. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_quadrangulated_spherical_surface (const double radius, sc_MPI_Comm comm); +int t8_forest_no_overlap (t8_forest_t forest); ``` """ -function t8_cmesh_new_quadrangulated_spherical_surface(radius, comm) - @ccall libt8.t8_cmesh_new_quadrangulated_spherical_surface(radius::Cdouble, comm::MPI_Comm)::t8_cmesh_t +function t8_forest_no_overlap(forest) + @ccall libt8.t8_forest_no_overlap(forest::t8_forest_t)::Cint end """ - t8_cmesh_new_prismed_spherical_shell_octahedron(inner_radius, shell_thickness, num_levels, num_layers, comm) + t8_forest_is_equal(forest_a, forest_b) + +Check whether two committed forests have the same local elements. + +!!! note + + This function is not collective. It only returns the state on the current rank. +# Arguments +* `forest_a`:\\[in\\] The first forest. +* `forest_b`:\\[in\\] The second forest. +# Returns +True if *forest_a* and *forest_b* do have the same number of local trees and each local tree has the same elements, that is t8_element_is_equal returns true for each pair of elements of *forest_a* and *forest_b*. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_prismed_spherical_shell_octahedron (const double inner_radius, const double shell_thickness, const int num_levels, const int num_layers, sc_MPI_Comm comm); +int t8_forest_is_equal (t8_forest_t forest_a, t8_forest_t forest_b); ``` """ -function t8_cmesh_new_prismed_spherical_shell_octahedron(inner_radius, shell_thickness, num_levels, num_layers, comm) - @ccall libt8.t8_cmesh_new_prismed_spherical_shell_octahedron(inner_radius::Cdouble, shell_thickness::Cdouble, num_levels::Cint, num_layers::Cint, comm::MPI_Comm)::t8_cmesh_t +function t8_forest_is_equal(forest_a, forest_b) + @ccall libt8.t8_forest_is_equal(forest_a::t8_forest_t, forest_b::t8_forest_t)::Cint end """ - t8_cmesh_new_prismed_spherical_shell_icosahedron(inner_radius, shell_thickness, num_levels, num_layers, comm) + t8_forest_set_cmesh(forest, cmesh, comm) ### Prototype ```c -t8_cmesh_t t8_cmesh_new_prismed_spherical_shell_icosahedron (const double inner_radius, const double shell_thickness, const int num_levels, const int num_layers, sc_MPI_Comm comm); +void t8_forest_set_cmesh (t8_forest_t forest, t8_cmesh_t cmesh, sc_MPI_Comm comm); ``` """ -function t8_cmesh_new_prismed_spherical_shell_icosahedron(inner_radius, shell_thickness, num_levels, num_layers, comm) - @ccall libt8.t8_cmesh_new_prismed_spherical_shell_icosahedron(inner_radius::Cdouble, shell_thickness::Cdouble, num_levels::Cint, num_layers::Cint, comm::MPI_Comm)::t8_cmesh_t +function t8_forest_set_cmesh(forest, cmesh, comm) + @ccall libt8.t8_forest_set_cmesh(forest::t8_forest_t, cmesh::t8_cmesh_t, comm::Cint)::Cvoid end """ - t8_cmesh_new_cubed_spherical_shell(inner_radius, shell_thickness, num_trees, num_layers, comm) + t8_forest_set_scheme(forest, scheme) + +Set the element scheme associated to a forest. By default, the forest takes ownership of the scheme such that it will be destroyed when the forest is destroyed. To keep ownership of the scheme, call t8_scheme_ref before passing it to t8_forest_set_scheme. This means that it is ILLEGAL to continue using scheme or dereferencing it UNLESS it is referenced directly before passing it into this function. +# Arguments +* `forest`:\\[in,out\\] The forest whose scheme variable will be set. +* `scheme`:\\[in\\] The scheme to be set. We take ownership. This can be prevented by referencing **scheme**. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_cubed_spherical_shell (const double inner_radius, const double shell_thickness, const int num_trees, const int num_layers, sc_MPI_Comm comm); +void t8_forest_set_scheme (t8_forest_t forest, const t8_scheme_c *scheme); ``` """ -function t8_cmesh_new_cubed_spherical_shell(inner_radius, shell_thickness, num_trees, num_layers, comm) - @ccall libt8.t8_cmesh_new_cubed_spherical_shell(inner_radius::Cdouble, shell_thickness::Cdouble, num_trees::Cint, num_layers::Cint, comm::MPI_Comm)::t8_cmesh_t +function t8_forest_set_scheme(forest, scheme) + @ccall libt8.t8_forest_set_scheme(forest::t8_forest_t, scheme::Ptr{t8_scheme_c})::Cvoid end """ - t8_cmesh_new_cubed_sphere(radius, comm) + t8_forest_set_level(forest, level) + +Set the initial refinement level to be used when **forest** is committed. + +!!! note + This setting cannot be combined with any of the derived forest methods (t8_forest_set_copy, t8_forest_set_adapt, t8_forest_set_partition, and t8_forest_set_balance) and overwrites any of these settings. If this function is used, then the forest is created from scratch as a uniform refinement of the specified cmesh (t8_forest_set_cmesh, t8_forest_set_scheme). + +# Arguments +* `forest`:\\[in,out\\] The forest whose level will be set. +* `level`:\\[in\\] The initial refinement level of **forest**, when it is committed. ### Prototype ```c -t8_cmesh_t t8_cmesh_new_cubed_sphere (const double radius, sc_MPI_Comm comm); +void t8_forest_set_level (t8_forest_t forest, int level); ``` """ -function t8_cmesh_new_cubed_sphere(radius, comm) - @ccall libt8.t8_cmesh_new_cubed_sphere(radius::Cdouble, comm::MPI_Comm)::t8_cmesh_t +function t8_forest_set_level(forest, level) + @ccall libt8.t8_forest_set_level(forest::t8_forest_t, level::Cint)::Cvoid end """ - t8_cmesh_get_tree_geom_hash(cmesh, gtreeid) + t8_forest_set_copy(forest, from) + +Set a forest as source for copying on committing. By default, the forest takes ownership of the source **from** such that it will be destroyed on calling t8_forest_commit. To keep ownership of **from**, call t8_forest_ref before passing it into this function. This means that it is ILLEGAL to continue using **from** or dereferencing it UNLESS it is referenced directly before passing it into this function. + +!!! note -Get the hash of the geometry stored for a tree in a cmesh. + This setting cannot be combined with t8_forest_set_adapt, t8_forest_set_partition, or t8_forest_set_balance and overwrites these settings. # Arguments -* `cmesh`:\\[in\\] A committed cmesh. -* `gtreeid`:\\[in\\] A global tree in *cmesh*. -# Returns -The hash of the tree's geometry or if only one geometry exists, its hash. +* `forest`:\\[in,out\\] The forest. +* `from`:\\[in\\] A second forest from which *forest* will be copied in t8_forest_commit. ### Prototype ```c -size_t t8_cmesh_get_tree_geom_hash (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); +void t8_forest_set_copy (t8_forest_t forest, const t8_forest_t from); ``` """ -function t8_cmesh_get_tree_geom_hash(cmesh, gtreeid) - @ccall libt8.t8_cmesh_get_tree_geom_hash(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t)::Csize_t +function t8_forest_set_copy(forest, from) + @ccall libt8.t8_forest_set_copy(forest::t8_forest_t, from::t8_forest_t)::Cvoid end """ - t8_cmesh_set_join_by_vertices(cmesh, ntrees, eclasses, vertices, connectivity, do_both_directions) + t8_forest_set_adapt(forest, set_from, adapt_fn, recursive) -Sets the face connectivity information of an un-committed based on a list of tree vertices. +Set a source forest with an adapt function to be adapted on committing. By default, the forest takes ownership of the source **set_from** such that it will be destroyed on calling t8_forest_commit. To keep ownership of **set_from**, call t8_forest_ref before passing it into this function. This means that it is ILLEGAL to continue using **set_from** or dereferencing it UNLESS it is referenced directly before passing it into this function. -!!! warning +!!! note - This routine might be too expensive for very large meshes. In this case, consider to use a fully featured mesh generator. + This setting can be combined with t8_forest_set_partition and t8_forest_set_balance. The order in which these operations are executed is always 1) Adapt 2) Partition 3) Balance. !!! note - This routine does not detect periodic boundaries. + This setting may not be combined with t8_forest_set_copy and overwrites this setting. # Arguments -* `cmesh`:\\[in,out\\] Pointer to a t8code cmesh object. If set to NULL this argument is ignored. -* `ntrees`:\\[in\\] Number of coarse mesh elements resp. trees. -* `vertices`:\\[in\\] List of per element vertices with dimensions [ntrees,[`T8_ECLASS_MAX_CORNERS`](@ref),[`T8_ECLASS_MAX_DIM`](@ref)]. -* `eclasses`:\\[in\\] List of element classes of length [ntrees]. -* `connectivity`:\\[in,out\\] If connectivity is not NULL the variable is filled with a pointer to an allocated face connectivity array. The ownership of this array goes to the caller. This argument is mainly used for debugging and testing purposes. The dimension of *connectivity* are [ntrees,[`T8_ECLASS_MAX_FACES`](@ref),3]. For each element and each face the following is stored: neighbor\\_tree\\_id, neighbor\\_dual\\_face\\_id, orientation -* `do_both_directions`:\\[in\\] Compute the connectivity from both neighboring sides. Takes much longer to compute. +* `forest`:\\[in,out\\] The forest +* `set_from`:\\[in\\] The source forest from which **forest** will be adapted. We take ownership. This can be prevented by referencing **set_from**. If NULL, a previously (or later) set forest will be taken (t8_forest_set_partition, t8_forest_set_balance). +* `adapt_fn`:\\[in\\] The adapt function used on committing. +* `recursive`:\\[in\\] A flag specifying whether adaptation is to be done recursively or not. If the value is zero, adaptation is not recursive and it is recursive otherwise. ### Prototype ```c -void t8_cmesh_set_join_by_vertices (t8_cmesh_t cmesh, const t8_gloidx_t ntrees, const t8_eclass_t *eclasses, const double *vertices, int **connectivity, const int do_both_directions); +void t8_forest_set_adapt (t8_forest_t forest, const t8_forest_t set_from, t8_forest_adapt_t adapt_fn, int recursive); ``` """ -function t8_cmesh_set_join_by_vertices(cmesh, ntrees, eclasses, vertices, connectivity, do_both_directions) - @ccall libt8.t8_cmesh_set_join_by_vertices(cmesh::t8_cmesh_t, ntrees::t8_gloidx_t, eclasses::Ptr{t8_eclass_t}, vertices::Ptr{Cdouble}, connectivity::Ptr{Ptr{Cint}}, do_both_directions::Cint)::Cvoid +function t8_forest_set_adapt(forest, set_from, adapt_fn, recursive) + @ccall libt8.t8_forest_set_adapt(forest::t8_forest_t, set_from::t8_forest_t, adapt_fn::t8_forest_adapt_t, recursive::Cint)::Cvoid end """ - t8_cmesh_set_join_by_stash(cmesh, connectivity, do_both_directions) + t8_forest_set_user_data(forest, data) -Sets the face connectivity information of an un-committed based on the cmesh stash. +Set the user data of a forest. This can i.e. be used to pass user defined arguments to the adapt routine. -!!! warning +# Arguments +* `forest`:\\[in,out\\] The forest +* `data`:\\[in\\] A pointer to user data. t8code will never touch the data. The forest does not need be committed before calling this function. +# See also +[`t8_forest_get_user_data`](@ref) - This routine might be too expensive for very large meshes. In this case, consider to use a fully featured mesh generator. +### Prototype +```c +void t8_forest_set_user_data (t8_forest_t forest, void *data); +``` +""" +function t8_forest_set_user_data(forest, data) + @ccall libt8.t8_forest_set_user_data(forest::t8_forest_t, data::Ptr{Cvoid})::Cvoid +end -!!! note +""" + t8_forest_get_user_data(forest) - This routine does not detect periodic boundaries. +Return the user data pointer associated with a forest. # Arguments -* `cmesh`:\\[in,out\\] An uncommitted cmesh. The trees eclasses and vertices do need to be set. -* `connectivity`:\\[in,out\\] If connectivity is not NULL the variable is filled with a pointer to an allocated face connectivity array. The ownership of this array goes to the caller. This argument is mainly used for debugging and testing purposes. The dimension of *connectivity* are [ntrees,[`T8_ECLASS_MAX_FACES`](@ref),3]. For each element and each face the following is stored: neighbor\\_tree\\_id, neighbor\\_dual\\_face\\_id, orientation -* `do_both_directions`:\\[in\\] Compute the connectivity from both neighboring sides. Takes much longer to compute. +* `forest`:\\[in\\] The forest. +# Returns +The user data pointer of *forest*. The forest does not need be committed before calling this function. +# See also +[`t8_forest_set_user_data`](@ref) + ### Prototype ```c -void t8_cmesh_set_join_by_stash (t8_cmesh_t cmesh, int **connectivity, const int do_both_directions); +void * t8_forest_get_user_data (const t8_forest_t forest); ``` """ -function t8_cmesh_set_join_by_stash(cmesh, connectivity, do_both_directions) - @ccall libt8.t8_cmesh_set_join_by_stash(cmesh::t8_cmesh_t, connectivity::Ptr{Ptr{Cint}}, do_both_directions::Cint)::Cvoid +function t8_forest_get_user_data(forest) + @ccall libt8.t8_forest_get_user_data(forest::t8_forest_t)::Ptr{Cvoid} end """ - t8_offset_first(proc, offset) + t8_forest_set_user_function(forest, _function) + +Set the user function pointer of a forest. This can i.e. be used to pass user defined functions to the adapt routine. -Return the global id of the first local tree of a given process in a partition. +!!! note + + *function* can be an arbitrary function with return value and parameters of your choice. When accessing it with t8_forest_get_user_function you should cast it into the proper type. # Arguments -* `proc`:\\[in\\] The rank of the process. -* `offset`:\\[in\\] The partition table. -# Returns -The global id of the first local tree of *proc* in the partition *offset*. +* `forest`:\\[in,out\\] The forest +* `function`:\\[in\\] A pointer to a user defined function. t8code will never touch the function. The forest does not need be committed before calling this function. +# See also +[`t8_forest_get_user_function`](@ref) + ### Prototype ```c -t8_gloidx_t t8_offset_first (const int proc, const t8_gloidx_t *offset); +void t8_forest_set_user_function (t8_forest_t forest, t8_generic_function_pointer function); ``` """ -function t8_offset_first(proc, offset) - @ccall libt8.t8_offset_first(proc::Cint, offset::Ptr{t8_gloidx_t})::t8_gloidx_t +function t8_forest_set_user_function(forest, _function) + @ccall libt8.t8_forest_set_user_function(forest::t8_forest_t, _function::t8_generic_function_pointer)::Cvoid end """ - t8_offset_first_tree_to_entry(first_tree, shared) + t8_forest_get_user_function(forest) -Given the global tree id of the first local tree of a process and the flag whether it is shared or not, compute the entry in the offset array. This entry is the first\\_tree if it is not shared and -first\\_tree - 1 if it is shared. +Return the user function pointer associated with a forest. # Arguments -* `first_tree`:\\[in\\] The global tree id of a process's first tree. -* `shared`:\\[in\\] 0 if *first_tree* is not shared with a smaller rank, 1 if it is. +* `forest`:\\[in\\] The forest. # Returns -The entry that represents the process in an offset array. *first_tree* if *shared* == 0 - *first_tree* - 1 if *shared* != 0 +The user function pointer of *forest*. The forest does not need be committed before calling this function. +# See also +[`t8_forest_set_user_function`](@ref) + ### Prototype ```c -t8_gloidx_t t8_offset_first_tree_to_entry (const t8_gloidx_t first_tree, const int shared); +t8_generic_function_pointer t8_forest_get_user_function (const t8_forest_t forest); ``` """ -function t8_offset_first_tree_to_entry(first_tree, shared) - @ccall libt8.t8_offset_first_tree_to_entry(first_tree::t8_gloidx_t, shared::Cint)::t8_gloidx_t +function t8_forest_get_user_function(forest) + @ccall libt8.t8_forest_get_user_function(forest::t8_forest_t)::t8_generic_function_pointer end """ - t8_offset_num_trees(proc, offset) + t8_forest_set_partition(forest, set_from, set_for_coarsening) + +Set a source forest to be partitioned during commit. The partitioning is done according to the SFC and each rank is assigned the same (maybe +1) number of elements. + +!!! note + + This setting can be combined with t8_forest_set_adapt and t8_forest_set_balance. The order in which these operations are executed is always 1) Adapt 2) Partition 3) Balance. If t8_forest_set_balance is called with the *no_repartition* parameter set as false, it is not necessary to call t8_forest_set_partition additionally. -The number of trees of a given process in a partition. +!!! note + + This setting may not be combined with t8_forest_set_copy and overwrites this setting. # Arguments -* `proc`:\\[in\\] A mpi rank. -* `offset`:\\[in\\] A partition table. -# Returns -The number of local trees of *proc* in the partition *offset*. +* `forest`:\\[in,out\\] The forest. +* `set_from`:\\[in\\] A second forest that should be partitioned. We take ownership. This can be prevented by referencing **set_from**. If NULL, a previously (or later) set forest will be taken (t8_forest_set_adapt, t8_forest_set_balance). +* `set_for_coarsening`:\\[in\\] CURRENTLY DISABLED. If true, then the partitions are choose such that coarsening an element once is a process local operation. ### Prototype ```c -t8_gloidx_t t8_offset_num_trees (const int proc, const t8_gloidx_t *offset); +void t8_forest_set_partition (t8_forest_t forest, const t8_forest_t set_from, int set_for_coarsening); ``` """ -function t8_offset_num_trees(proc, offset) - @ccall libt8.t8_offset_num_trees(proc::Cint, offset::Ptr{t8_gloidx_t})::t8_gloidx_t +function t8_forest_set_partition(forest, set_from, set_for_coarsening) + @ccall libt8.t8_forest_set_partition(forest::t8_forest_t, set_from::t8_forest_t, set_for_coarsening::Cint)::Cvoid end """ - t8_offset_last(proc, offset) + t8_forest_set_balance(forest, set_from, no_repartition) + +Set a source forest to be balanced during commit. A forest is said to be balanced if each element has face neighbors of level at most +1 or -1 of the element's level. + +!!! note + + This setting can be combined with t8_forest_set_adapt and t8_forest_set_partition. The order in which these operations are executed is always 1) Adapt 2) Partition 3) Balance. -Return the last local tree of a given process in a partition. +!!! note + + This setting may not be combined with t8_forest_set_copy and overwrites this setting. # Arguments -* `proc`:\\[in\\] A mpi rank. -* `offset`:\\[in\\] A partition table. -# Returns -The global tree id of the last local tree of *proc* in *offset*. +* `forest`:\\[in,out\\] The forest. +* `set_from`:\\[in\\] A second forest that should be balanced. We take ownership. This can be prevented by referencing **set_from**. If NULL, a previously (or later) set forest will be taken (t8_forest_set_adapt, t8_forest_set_partition) +* `no_repartition`:\\[in\\] Balance constructs several intermediate forest that are refined from each other. In order to maintain a balanced load these forest are repartitioned in each round and the resulting forest is load-balanced per default. If this behaviour is not desired, *no_repartition* should be set to true. If *no_repartition* is false, an additional call of t8_forest_set_partition is not necessary. ### Prototype ```c -t8_gloidx_t t8_offset_last (const int proc, const t8_gloidx_t *offset); +void t8_forest_set_balance (t8_forest_t forest, const t8_forest_t set_from, int no_repartition); ``` """ -function t8_offset_last(proc, offset) - @ccall libt8.t8_offset_last(proc::Cint, offset::Ptr{t8_gloidx_t})::t8_gloidx_t +function t8_forest_set_balance(forest, set_from, no_repartition) + @ccall libt8.t8_forest_set_balance(forest::t8_forest_t, set_from::t8_forest_t, no_repartition::Cint)::Cvoid end """ - t8_offset_empty(proc, offset) + t8_forest_set_ghost(forest, do_ghost, ghost_type) -Check whether a given process has no local trees in a given partition. +Enable or disable the creation of a layer of ghost elements. On default no ghosts are created. # Arguments -* `proc`:\\[in\\] A mpi rank. -* `offset`:\\[in\\] A partition table. -# Returns -nonzero if *proc* does not have local trees in *offset*. 0 otherwise. +* `forest`:\\[in\\] The forest. +* `do_ghost`:\\[in\\] If non-zero a ghost layer will be created. +* `ghost_type`:\\[in\\] Controls which neighbors count as ghost elements, currently only T8\\_GHOST\\_FACES is supported. This value is ignored if *do_ghost* = 0. ### Prototype ```c -int t8_offset_empty (const int proc, const t8_gloidx_t *offset); +void t8_forest_set_ghost (t8_forest_t forest, int do_ghost, t8_ghost_type_t ghost_type); ``` """ -function t8_offset_empty(proc, offset) - @ccall libt8.t8_offset_empty(proc::Cint, offset::Ptr{t8_gloidx_t})::Cint +function t8_forest_set_ghost(forest, do_ghost, ghost_type) + @ccall libt8.t8_forest_set_ghost(forest::t8_forest_t, do_ghost::Cint, ghost_type::t8_ghost_type_t)::Cvoid end """ - t8_offset_next_nonempty_rank(rank, mpisize, offset) + t8_forest_set_ghost_ext(forest, do_ghost, ghost_type, ghost_version) -Find the next higher rank that is not empty. returns mpisize if this rank does not exist. +Like t8_forest_set_ghost but with the additional options to change the ghost algorithm. This is used for debugging and timing the algorithm. An application should almost always use t8_forest_set_ghost. + +# Arguments +* `forest`:\\[in\\] The forest. +* `do_ghost`:\\[in\\] If non-zero a ghost layer will be created. +* `ghost_type`:\\[in\\] Controls which neighbors count as ghost elements, currently only T8\\_GHOST\\_FACES is supported. This value is ignored if *do_ghost* = 0. +* `ghost_version`:\\[in\\] If 1, the iterative ghost algorithm for balanced forests is used. If 2, the iterative algorithm for unbalanced forests. If 3, the top-down search algorithm for unbalanced forests. +# See also +[`t8_forest_set_ghost`](@ref) -# Arguments -* `proc`:\\[in\\] An MPI rank. -* `mpisize`:\\[in\\] The number of total MPI ranks. -* `offset`:\\[in\\] An array with at least *mpisize* + 1 entries. -# Returns -A rank *p* such that *p* > *rank* and [`t8_offset_empty`](@ref) (*p*, *offset*) is True and [`t8_offset_empty`](@ref) (*q*, *offset*) is False for all *rank* < *q* < *p*. If no such *q* exists, *mpisize* is returned. ### Prototype ```c -int t8_offset_next_nonempty_rank (const int rank, const int mpisize, const t8_gloidx_t *offset); +void t8_forest_set_ghost_ext (t8_forest_t forest, int do_ghost, t8_ghost_type_t ghost_type, int ghost_version); ``` """ -function t8_offset_next_nonempty_rank(rank, mpisize, offset) - @ccall libt8.t8_offset_next_nonempty_rank(rank::Cint, mpisize::Cint, offset::Ptr{t8_gloidx_t})::Cint +function t8_forest_set_ghost_ext(forest, do_ghost, ghost_type, ghost_version) + @ccall libt8.t8_forest_set_ghost_ext(forest::t8_forest_t, do_ghost::Cint, ghost_type::t8_ghost_type_t, ghost_version::Cint)::Cvoid end """ - t8_offset_in_range(tree_id, proc, offset) + t8_forest_set_load(forest, filename) -Determine whether a given global tree id is a local tree of a given process in a certain partition. +Use assertions and document that the forest\\_set (..., from) and set\\_load are mutually exclusive. + +TODO: Unused function -> remove? -# Arguments -* `tree_id`:\\[in\\] A global tree id. -* `proc`:\\[in\\] A mpi rank. -* `offset`:\\[in\\] A partition table. -# Returns -nonzero if *tree_id* is a local tree of *proc* in *offset*. 0 if it is not. ### Prototype ```c -int t8_offset_in_range (const t8_gloidx_t tree_id, const int proc, const t8_gloidx_t *offset); +void t8_forest_set_load (t8_forest_t forest, const char *filename); ``` """ -function t8_offset_in_range(tree_id, proc, offset) - @ccall libt8.t8_offset_in_range(tree_id::t8_gloidx_t, proc::Cint, offset::Ptr{t8_gloidx_t})::Cint +function t8_forest_set_load(forest, filename) + @ccall libt8.t8_forest_set_load(forest::t8_forest_t, filename::Cstring)::Cvoid end """ - t8_offset_any_owner_of_tree(mpisize, gtree, offset) + t8_forest_comm_global_num_leaf_elements(forest) -Find any process that has a given tree as local tree. +Compute the global number of leaf elements in a forest as the sum of the local leaf element counts. # Arguments -* `mpisize`:\\[in\\] The number of MPI ranks, also the number of entries in *offset* minus 1. -* `gtree`:\\[in\\] The global id of a tree. -* `offset`:\\[in\\] The partition to be considered. -# Returns -An MPI rank that has *gtree* as a local tree. +* `forest`:\\[in\\] The forest. ### Prototype ```c -int t8_offset_any_owner_of_tree (const int mpisize, const t8_gloidx_t gtree, const t8_gloidx_t *offset); +void t8_forest_comm_global_num_leaf_elements (t8_forest_t forest); ``` """ -function t8_offset_any_owner_of_tree(mpisize, gtree, offset) - @ccall libt8.t8_offset_any_owner_of_tree(mpisize::Cint, gtree::t8_gloidx_t, offset::Ptr{t8_gloidx_t})::Cint +function t8_forest_comm_global_num_leaf_elements(forest) + @ccall libt8.t8_forest_comm_global_num_leaf_elements(forest::t8_forest_t)::Cvoid end """ - t8_offset_any_owner_of_tree_ext(mpisize, start_proc, gtree, offset) + t8_forest_commit(forest) -Find any process that has a given tree as local tree. +After allocating and adding properties to a forest, commit the changes. This call sets up the internal state of the forest. # Arguments -* `mpisize`:\\[in\\] The number of MPI ranks, also the number of entries in *offset* minus 1. -* `start_proc`:\\[in\\] The mpirank to start the search with. -* `gtree`:\\[in\\] The global id of a tree. -* `offset`:\\[in\\] The partition to be considered. -# Returns -An MPI rank that has *gtree* as a local tree. +* `forest`:\\[in,out\\] Must be created with t8_forest_init and specialized with t8\\_forest\\_set\\_* calls first. ### Prototype ```c -int t8_offset_any_owner_of_tree_ext (const int mpisize, const int start_proc, const t8_gloidx_t gtree, const t8_gloidx_t *offset); +void t8_forest_commit (t8_forest_t forest); ``` """ -function t8_offset_any_owner_of_tree_ext(mpisize, start_proc, gtree, offset) - @ccall libt8.t8_offset_any_owner_of_tree_ext(mpisize::Cint, start_proc::Cint, gtree::t8_gloidx_t, offset::Ptr{t8_gloidx_t})::Cint +function t8_forest_commit(forest) + @ccall libt8.t8_forest_commit(forest::t8_forest_t)::Cvoid end """ - t8_offset_first_owner_of_tree(mpisize, gtree, offset, some_owner) + t8_forest_get_maxlevel(forest) -Find the smallest process that has a given tree as local tree. To increase the runtime, an arbitrary process having this tree as local tree can be passed as an argument. Otherwise, such an owner is computed during the call. +Return the maximum allowed refinement level for any element in a forest. # Arguments -* `mpisize`:\\[in\\] The number of MPI ranks, also the number of entries in *offset* minus 1. -* `gtree`:\\[in\\] The global id of a tree. -* `offset`:\\[in\\] The partition to be considered. -* `some_owner`:\\[in\\] If >= 0 considered as input: a process that has *gtree* as local tree. If < 0 on output a process that has *gtree* as local tree. Specifying *some_owner* increases the runtime from O(log mpisize) to O(n), where n is the number of owners of the tree. +* `forest`:\\[in\\] A forest. # Returns -The smallest rank that has *gtree* as a local tree. +The maximum level of refinement that is allowed for an element in this forest. It is guaranteed that any tree in *forest* can be refined this many times and it is not allowed to refine further. *forest* must be committed before calling this function. For forest with a single element class (non-hybrid) maxlevel is the maximum refinement level of this element class, whilst for hybrid forests the maxlevel is the minimum of all maxlevels of the element classes in this forest. ### Prototype ```c -int t8_offset_first_owner_of_tree (const int mpisize, const t8_gloidx_t gtree, const t8_gloidx_t *offset, int *some_owner); +int t8_forest_get_maxlevel (const t8_forest_t forest); ``` """ -function t8_offset_first_owner_of_tree(mpisize, gtree, offset, some_owner) - @ccall libt8.t8_offset_first_owner_of_tree(mpisize::Cint, gtree::t8_gloidx_t, offset::Ptr{t8_gloidx_t}, some_owner::Ptr{Cint})::Cint +function t8_forest_get_maxlevel(forest) + @ccall libt8.t8_forest_get_maxlevel(forest::t8_forest_t)::Cint end """ - t8_offset_last_owner_of_tree(mpisize, gtree, offset, some_owner) + t8_forest_get_local_num_leaf_elements(forest) -Find the biggest process that has a given tree as local tree. To increase the runtime, an arbitrary process having this tree as local tree can be passed as an argument. Otherwise, such an owner is computed during the call. +Return the number of process local leaf elements in the forest. # Arguments -* `mpisize`:\\[in\\] The number of MPI ranks, also the number of entries in *offset* minus 1. -* `gtree`:\\[in\\] The global id of a tree. -* `offset`:\\[in\\] The partition to be considered. -* `some_owner`:\\[in,out\\] If >= 0 considered as input: a process that has *gtree* as local tree. If < 0 on output a process that has *gtree* as local tree. Specifying *some_owner* increases the runtime from O(log mpisize) to O(n), where n is the number of owners of the tree. +* `forest`:\\[in\\] A forest. # Returns -The biggest rank that has *gtree* as a local tree. +The number of leaf elements on this process in *forest*. *forest* must be committed before calling this function. ### Prototype ```c -int t8_offset_last_owner_of_tree (const int mpisize, const t8_gloidx_t gtree, const t8_gloidx_t *offset, int *some_owner); +t8_locidx_t t8_forest_get_local_num_leaf_elements (const t8_forest_t forest); ``` """ -function t8_offset_last_owner_of_tree(mpisize, gtree, offset, some_owner) - @ccall libt8.t8_offset_last_owner_of_tree(mpisize::Cint, gtree::t8_gloidx_t, offset::Ptr{t8_gloidx_t}, some_owner::Ptr{Cint})::Cint +function t8_forest_get_local_num_leaf_elements(forest) + @ccall libt8.t8_forest_get_local_num_leaf_elements(forest::t8_forest_t)::t8_locidx_t end """ - t8_offset_next_owner_of_tree(mpisize, gtree, offset, current_owner) + t8_forest_get_global_num_leaf_elements(forest) -Given a process current\\_owner that has the tree gtree as local tree, find the next bigger rank that also has this tree as local tree. +Return the number of global leaf elements in the forest. # Arguments -* `mpisize`:\\[in\\] The number of MPI ranks, also the number of entries in *offset* minus 1. -* `gtree`:\\[in\\] The global id of a tree. -* `offset`:\\[in\\] The partition to be considered. -* `current_owner`:\\[in\\] A process that has *gtree* as local tree. +* `forest`:\\[in\\] A forest. # Returns -The MPI rank of the next bigger rank than *current_owner* that has *gtree* as local tree. -1 if non such rank exists. +The number of leaf elements (summed over all processes) in *forest*. *forest* must be committed before calling this function. ### Prototype ```c -int t8_offset_next_owner_of_tree (const int mpisize, const t8_gloidx_t gtree, const t8_gloidx_t *offset, int current_owner); +t8_gloidx_t t8_forest_get_global_num_leaf_elements (const t8_forest_t forest); ``` """ -function t8_offset_next_owner_of_tree(mpisize, gtree, offset, current_owner) - @ccall libt8.t8_offset_next_owner_of_tree(mpisize::Cint, gtree::t8_gloidx_t, offset::Ptr{t8_gloidx_t}, current_owner::Cint)::Cint +function t8_forest_get_global_num_leaf_elements(forest) + @ccall libt8.t8_forest_get_global_num_leaf_elements(forest::t8_forest_t)::t8_gloidx_t end """ - t8_offset_prev_owner_of_tree(mpisize, gtree, offset, current_owner) + t8_forest_get_num_ghosts(forest) -Given a process current\\_owner that has the tree gtree as local tree, find the next smaller rank that also has this tree as local tree. +Return the number of ghost elements of a forest. # Arguments -* `mpisize`:\\[in\\] The number of MPI ranks, also the number of entries in *offset* minus 1. -* `gtree`:\\[in\\] The global id of a tree. -* `offset`:\\[in\\] The partition to be considered. -* `current_owner`:\\[in\\] A process that has *gtree* as local tree. +* `forest`:\\[in\\] The forest. # Returns -The MPI rank of the next smaller rank than *current_owner* that has *gtree* as local tree. -1 if non such rank exists. +The number of ghost elements stored in the ghost structure of *forest*. 0 if no ghosts were constructed. +# See also +[`t8_forest_set_ghost`](@ref) *forest* must be committed before calling this function. + ### Prototype ```c -int t8_offset_prev_owner_of_tree (const int mpisize, const t8_gloidx_t gtree, const t8_gloidx_t *offset, const int current_owner); +t8_locidx_t t8_forest_get_num_ghosts (const t8_forest_t forest); ``` """ -function t8_offset_prev_owner_of_tree(mpisize, gtree, offset, current_owner) - @ccall libt8.t8_offset_prev_owner_of_tree(mpisize::Cint, gtree::t8_gloidx_t, offset::Ptr{t8_gloidx_t}, current_owner::Cint)::Cint +function t8_forest_get_num_ghosts(forest) + @ccall libt8.t8_forest_get_num_ghosts(forest::t8_forest_t)::t8_locidx_t end """ - t8_offset_all_owners_of_tree(mpisize, gtree, offset, owners) + t8_forest_get_eclass(forest, ltreeid) -Compute a list of all processes that own a specific tree.n *offset* minus 1. +Return the element class of a forest local tree. # Arguments -* `mpisize`:\\[in\\] The number of MPI ranks, also the number of entries in *offset* minus 1. -* `gtree`:\\[in\\] The global index of a tree. -* `offset`:\\[in\\] The partition to be considered. -* `owners`:\\[in,out\\] On input an initialized [`sc_array`](@ref) with integer entries and zero elements. On output a sorted list of all MPI ranks that have *gtree* as a local tree in *offset*. +* `forest`:\\[in\\] The forest. +* `ltreeid`:\\[in\\] The local id of a tree in *forest*. +# Returns +The element class of the tree *ltreeid*. *forest* must be committed before calling this function. ### Prototype ```c -void t8_offset_all_owners_of_tree (const int mpisize, const t8_gloidx_t gtree, const t8_gloidx_t *offset, sc_array_t *owners); +t8_eclass_t t8_forest_get_eclass (const t8_forest_t forest, const t8_locidx_t ltreeid); ``` """ -function t8_offset_all_owners_of_tree(mpisize, gtree, offset, owners) - @ccall libt8.t8_offset_all_owners_of_tree(mpisize::Cint, gtree::t8_gloidx_t, offset::Ptr{t8_gloidx_t}, owners::Ptr{sc_array_t})::Cvoid +function t8_forest_get_eclass(forest, ltreeid) + @ccall libt8.t8_forest_get_eclass(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_eclass_t end """ - t8_offset_nosend(proc, mpisize, offset_from, offset_to) + t8_forest_tree_is_local(forest, local_tree) -Query whether in a repartition setting a given process does send any of its local trees to any other process (including itself) +Check whether a given tree id belongs to a local tree in a forest. # Arguments -* `proc`:\\[in\\] A mpi rank. -* `mpisize`:\\[in\\] The number of MPI ranks, also the number of entries in *offset* minus 1. -* `offset_from`:\\[in\\] The partition table of the current partition. -* `offset_to`:\\[in\\] The partition table of the next partition. +* `forest`:\\[in\\] The forest. +* `local_tree`:\\[in\\] A tree id. # Returns -nonzero if *proc* will not send any local trees if we repartition from *offset_from* to *offset_to* 0 if it does send local trees. +True if and only if the id *local_tree* belongs to a local tree of *forest*. *forest* must be committed before calling this function. ### Prototype ```c -int t8_offset_nosend (int proc, int mpisize, const t8_gloidx_t *offset_from, const t8_gloidx_t *offset_to); +int t8_forest_tree_is_local (const t8_forest_t forest, const t8_locidx_t local_tree); ``` """ -function t8_offset_nosend(proc, mpisize, offset_from, offset_to) - @ccall libt8.t8_offset_nosend(proc::Cint, mpisize::Cint, offset_from::Ptr{t8_gloidx_t}, offset_to::Ptr{t8_gloidx_t})::Cint +function t8_forest_tree_is_local(forest, local_tree) + @ccall libt8.t8_forest_tree_is_local(forest::t8_forest_t, local_tree::t8_locidx_t)::Cint end """ - t8_offset_sendsto(proca, procb, t8_offset_from, t8_offset_to) + t8_forest_get_local_id(forest, gtreeid) -Query whether in a repartitioning setting, a given process sends local trees (and then possibly ghosts) to a given other process. +Given a global tree id compute the forest local id of this tree. If the tree is a local tree, then the local id is between 0 and the number of local trees. If the tree is not a local tree, a negative number is returned. # Arguments -* `proca`:\\[in\\] Mpi rank of the possible sending process. -* `procb`:\\[in\\] Mpi rank of the possible receiver. -* `offset_from`:\\[in\\] The partition table of the current partition. -* `offset_to`:\\[in\\] The partition table of the next partition. +* `forest`:\\[in\\] The forest. +* `gtreeid`:\\[in\\] The global id of a tree. # Returns -nonzero if *proca* does send local trees to *procb* when we repartition from *offset_from* to *offset_to*. 0 else. +The tree's local id in *forest*, if it is a local tree. A negative number if not. Ghosts trees are not considered as local. +# See also +[`t8_forest_get_local_or_ghost_id`](@ref) for ghost trees., https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. + ### Prototype ```c -int t8_offset_sendsto (int proca, int procb, const t8_gloidx_t *t8_offset_from, const t8_gloidx_t *t8_offset_to); +t8_locidx_t t8_forest_get_local_id (const t8_forest_t forest, const t8_gloidx_t gtreeid); ``` """ -function t8_offset_sendsto(proca, procb, t8_offset_from, t8_offset_to) - @ccall libt8.t8_offset_sendsto(proca::Cint, procb::Cint, t8_offset_from::Ptr{t8_gloidx_t}, t8_offset_to::Ptr{t8_gloidx_t})::Cint +function t8_forest_get_local_id(forest, gtreeid) + @ccall libt8.t8_forest_get_local_id(forest::t8_forest_t, gtreeid::t8_gloidx_t)::t8_locidx_t end """ - t8_offset_sendstree(proc_send, proc_to, gtree, offset_from, offset_to) + t8_forest_get_local_or_ghost_id(forest, gtreeid) -Query whether in a repartitioning setting, a given process sends a given tree to a second process. +Given a global tree id compute the forest local id of this tree. If the tree is a local tree, then the local id is between 0 and the number of local trees. If the tree is a ghost, then the local id is between num\\_local\\_trees and num\\_local\\_trees + num\\_ghost\\_trees. If the tree is neither a local tree nor a ghost tree, a negative number is returned. # Arguments -* `proc_send`:\\[in\\] Mpi rank of the possible sending process. -* `proc_recv`:\\[in\\] Mpi rank of the possible receiver. -* `gtree`:\\[in\\] A global tree id. -* `offset_from`:\\[in\\] The partition table of the current partition. -* `offset_to`:\\[in\\] The partition table of the next partition. +* `forest`:\\[in\\] The forest. +* `gtreeid`:\\[in\\] The global id of a tree. # Returns -nonzero if *proc_send* will send the tree *gtree* to *proc_recv*. 0 else. When calling, *gtree* must not be a local tree of *proc_send* in *offset_from*. In this case, 0 is always returned. +The tree's local id in *forest*, if it is a local tree. num\\_local\\_trees + the ghosts id, if it is a ghost tree. A negative number if not. +# See also +https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing + ### Prototype ```c -int t8_offset_sendstree (int proc_send, int proc_to, t8_gloidx_t gtree, const t8_gloidx_t *offset_from, const t8_gloidx_t *offset_to); +t8_locidx_t t8_forest_get_local_or_ghost_id (const t8_forest_t forest, const t8_gloidx_t gtreeid); ``` """ -function t8_offset_sendstree(proc_send, proc_to, gtree, offset_from, offset_to) - @ccall libt8.t8_offset_sendstree(proc_send::Cint, proc_to::Cint, gtree::t8_gloidx_t, offset_from::Ptr{t8_gloidx_t}, offset_to::Ptr{t8_gloidx_t})::Cint +function t8_forest_get_local_or_ghost_id(forest, gtreeid) + @ccall libt8.t8_forest_get_local_or_ghost_id(forest::t8_forest_t, gtreeid::t8_gloidx_t)::t8_locidx_t end """ - t8_offset_range_send(start, _end, mpirank, offset_from, offset_to) + t8_forest_ltreeid_to_cmesh_ltreeid(forest, ltreeid) + +Given the local id of a tree in a forest, compute the tree's local id in the associated cmesh. -Count the number of processes in a given range [a,b] that send to a given other process in a repartitioning setting. +!!! note + + For forest local trees, this is the inverse function of t8_forest_cmesh_ltreeid_to_ltreeid. # Arguments -* `start`:\\[in\\] The first mpi rank to be considered as sender. -* `end`:\\[in\\] The last mpi rank to be considered as sender. -* `mpirank`:\\[in\\] The mpirank to be considered as receiver. -* `offset_from`:\\[in\\] The partition table of the current partition. -* `offset_to`:\\[in\\] The partition table of the next partition. +* `forest`:\\[in\\] The forest. +* `ltreeid`:\\[in\\] The local id of a tree or ghost in the forest. # Returns -The number of processes p, such that *start* <= p <= *end* and p does send local trees (and possibly ghosts) to *mpirank*. -### Prototype -```c -int t8_offset_range_send (int start, int end, int mpirank, const t8_gloidx_t *offset_from, const t8_gloidx_t *offset_to); -``` -""" -function t8_offset_range_send(start, _end, mpirank, offset_from, offset_to) - @ccall libt8.t8_offset_range_send(start::Cint, _end::Cint, mpirank::Cint, offset_from::Ptr{t8_gloidx_t}, offset_to::Ptr{t8_gloidx_t})::Cint -end - -""" - t8_offset_print(offset, comm) +The local id of the tree in the cmesh associated with the forest. *forest* must be committed before calling this function. +# See also +https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. ### Prototype ```c -void t8_offset_print (t8_shmem_array_t offset, sc_MPI_Comm comm); +t8_locidx_t t8_forest_ltreeid_to_cmesh_ltreeid (t8_forest_t forest, t8_locidx_t ltreeid); ``` """ -function t8_offset_print(offset, comm) - @ccall libt8.t8_offset_print(offset::t8_shmem_array_t, comm::MPI_Comm)::Cvoid +function t8_forest_ltreeid_to_cmesh_ltreeid(forest, ltreeid) + @ccall libt8.t8_forest_ltreeid_to_cmesh_ltreeid(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_locidx_t end """ - t8_cmesh_partition(cmesh, comm) + t8_forest_cmesh_ltreeid_to_ltreeid(forest, lctreeid) -### Prototype -```c -void t8_cmesh_partition (t8_cmesh_t cmesh, sc_MPI_Comm comm); -``` -""" -function t8_cmesh_partition(cmesh, comm) - @ccall libt8.t8_cmesh_partition(cmesh::t8_cmesh_t, comm::MPI_Comm)::Cvoid -end +Given the local id of a tree in the coarse mesh of a forest, compute the tree's local id in the forest. -""" - t8_cmesh_gather_trees_per_eclass(cmesh, comm) +!!! note -### Prototype -```c -void t8_cmesh_gather_trees_per_eclass (t8_cmesh_t cmesh, sc_MPI_Comm comm); -``` -""" -function t8_cmesh_gather_trees_per_eclass(cmesh, comm) - @ccall libt8.t8_cmesh_gather_trees_per_eclass(cmesh::t8_cmesh_t, comm::MPI_Comm)::Cvoid -end + For forest local trees, this is the inverse function of t8_forest_ltreeid_to_cmesh_ltreeid. -""" - t8_cmesh_gather_treecount(cmesh, comm) +# Arguments +* `forest`:\\[in\\] The forest. +* `lctreeid`:\\[in\\] The local id of a tree in the coarse mesh of *forest*. +# Returns +The local id of the tree in the forest. -1 if the tree is not forest local. *forest* must be committed before calling this function. +# See also +https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. ### Prototype ```c -void t8_cmesh_gather_treecount (t8_cmesh_t cmesh, sc_MPI_Comm comm); +t8_locidx_t t8_forest_cmesh_ltreeid_to_ltreeid (t8_forest_t forest, t8_locidx_t lctreeid); ``` """ -function t8_cmesh_gather_treecount(cmesh, comm) - @ccall libt8.t8_cmesh_gather_treecount(cmesh::t8_cmesh_t, comm::MPI_Comm)::Cvoid +function t8_forest_cmesh_ltreeid_to_ltreeid(forest, lctreeid) + @ccall libt8.t8_forest_cmesh_ltreeid_to_ltreeid(forest::t8_forest_t, lctreeid::t8_locidx_t)::t8_locidx_t end """ - t8_cmesh_gather_treecount_nocommit(cmesh, comm) + t8_forest_get_coarse_tree(forest, ltreeid) +Given the local id of a tree in a forest, return the coarse tree of the cmesh that corresponds to this tree. + +# Arguments +* `forest`:\\[in\\] The forest. +* `ltreeid`:\\[in\\] The local id of a tree in the forest. +# Returns +The coarse tree that matches the forest tree with local id *ltreeid*. ### Prototype ```c -void t8_cmesh_gather_treecount_nocommit (t8_cmesh_t cmesh, sc_MPI_Comm comm); +t8_ctree_t t8_forest_get_coarse_tree (t8_forest_t forest, t8_locidx_t ltreeid); ``` """ -function t8_cmesh_gather_treecount_nocommit(cmesh, comm) - @ccall libt8.t8_cmesh_gather_treecount_nocommit(cmesh::t8_cmesh_t, comm::MPI_Comm)::Cvoid +function t8_forest_get_coarse_tree(forest, ltreeid) + @ccall libt8.t8_forest_get_coarse_tree(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_ctree_t end """ - t8_cmesh_offset_print(cmesh, comm) + t8_forest_element_is_leaf(forest, element, local_tree) -### Prototype -```c -void t8_cmesh_offset_print (t8_cmesh_t cmesh, sc_MPI_Comm comm); -``` -""" -function t8_cmesh_offset_print(cmesh, comm) - @ccall libt8.t8_cmesh_offset_print(cmesh::t8_cmesh_t, comm::MPI_Comm)::Cvoid -end +Query whether a given element is a leaf in a forest. -""" - t8_cmesh_offset_concentrate(proc, comm, num_trees) +!!! note -### Prototype -```c -t8_shmem_array_t t8_cmesh_offset_concentrate (int proc, sc_MPI_Comm comm, t8_gloidx_t num_trees); -``` -""" -function t8_cmesh_offset_concentrate(proc, comm, num_trees) - @ccall libt8.t8_cmesh_offset_concentrate(proc::Cint, comm::MPI_Comm, num_trees::t8_gloidx_t)::t8_shmem_array_t -end + This does not query for ghost leaves. -""" - t8_cmesh_offset_random(comm, num_trees, shared, seed) +!!! note + + *forest* must be committed before calling this function. +# Arguments +* `forest`:\\[in\\] The forest. +* `element`:\\[in\\] An element of a local tree in *forest*. +* `local_tree`:\\[in\\] A local tree id of *forest*. +# Returns +True (non-zero) if and only if *element* is a leaf in *local_tree* of *forest*. ### Prototype ```c -t8_shmem_array_t t8_cmesh_offset_random (sc_MPI_Comm comm, t8_gloidx_t num_trees, int shared, unsigned seed); +int t8_forest_element_is_leaf (const t8_forest_t forest, const t8_element_t *element, const t8_locidx_t local_tree); ``` """ -function t8_cmesh_offset_random(comm, num_trees, shared, seed) - @ccall libt8.t8_cmesh_offset_random(comm::MPI_Comm, num_trees::t8_gloidx_t, shared::Cint, seed::Cuint)::t8_shmem_array_t +function t8_forest_element_is_leaf(forest, element, local_tree) + @ccall libt8.t8_forest_element_is_leaf(forest::t8_forest_t, element::Ptr{t8_element_t}, local_tree::t8_locidx_t)::Cint end """ - t8_cmesh_offset_half(cmesh, comm) + t8_forest_leaf_face_orientation(forest, ltreeid, scheme, leaf, face) -### Prototype -```c -t8_shmem_array_t t8_cmesh_offset_half (t8_cmesh_t cmesh, sc_MPI_Comm comm); -``` -""" -function t8_cmesh_offset_half(cmesh, comm) - @ccall libt8.t8_cmesh_offset_half(cmesh::t8_cmesh_t, comm::MPI_Comm)::t8_shmem_array_t -end +Compute the leaf face orientation at given face in a forest. -""" - t8_cmesh_offset_percent(cmesh, comm, percent) +For more information about the encoding of face orientation refer to t8_cmesh_get_face_neighbor. +# Arguments +* `forest`:\\[in\\] The forest. Must have a valid ghost layer. +* `ltreeid`:\\[in\\] A local tree id. +* `scheme`:\\[in\\] The eclass scheme of the element. +* `leaf`:\\[in\\] A leaf in tree *ltreeid* of *forest*. +* `face`:\\[in\\] The index of the face across which the face neighbors are searched. +# Returns +Face orientation encoded as integer. ### Prototype ```c -t8_shmem_array_t t8_cmesh_offset_percent (t8_cmesh_t cmesh, sc_MPI_Comm comm, int percent); +int t8_forest_leaf_face_orientation (t8_forest_t forest, const t8_locidx_t ltreeid, const t8_scheme_c *scheme, const t8_element_t *leaf, const int face); ``` """ -function t8_cmesh_offset_percent(cmesh, comm, percent) - @ccall libt8.t8_cmesh_offset_percent(cmesh::t8_cmesh_t, comm::MPI_Comm, percent::Cint)::t8_shmem_array_t -end - -""" - t8_stash_class - -The eclass information that is stored before a cmesh is committed. - -| Field | Note | -| :----- | :----------------------- | -| id | The global tree id | -| eclass | The eclass of that tree | -""" -struct t8_stash_class - id::t8_gloidx_t - eclass::t8_eclass_t +function t8_forest_leaf_face_orientation(forest, ltreeid, scheme, leaf, face) + @ccall libt8.t8_forest_leaf_face_orientation(forest::t8_forest_t, ltreeid::t8_locidx_t, scheme::Ptr{t8_scheme_c}, leaf::Ptr{t8_element_t}, face::Cint)::Cint end -"""The eclass information that is stored before a cmesh is committed.""" -const t8_stash_class_struct_t = t8_stash_class - -""" - t8_stash_joinface - -The face-connection information that is stored before a cmesh is committed. - -| Field | Note | -| :---------- | :------------------------------------------------------------------------- | -| id1 | The global tree id of the first tree in the connection. | -| id2 | The global tree id of the second tree. We ensure id1<=id2. | -| face1 | The face number of the first of the connected faces. | -| face2 | The face number of the second face. | -| orientation | The orientation of the face connection. # See also t8\\_cmesh\\_types.h. | """ -struct t8_stash_joinface - id1::t8_gloidx_t - id2::t8_gloidx_t - face1::Cint - face2::Cint - orientation::Cint -end - -"""The face-connection information that is stored before a cmesh is committed.""" -const t8_stash_joinface_struct_t = t8_stash_joinface + t8_forest_leaf_face_neighbors(forest, ltreeid, leaf, pneighbor_leaves, face, dual_faces, num_neighbors, pelement_indices, pneigh_eclass, forest_is_balanced) -""" - t8_stash_attribute +Compute the leaf face neighbors of a forest. -The attribute information that is stored before a cmesh is committed. The pair (package\\_id, key) serves as a lookup key to identify the data. +!!! note -| Field | Note | -| :----------- | :---------------------------------------------------------------------- | -| id | The global tree id | -| attr\\_size | The size (in bytes) of this attribute | -| attr\\_data | Array of *size* bytes storing the attributes data. | -| is\\_owned | True if the data was copied, false if the data is still owned by user. | -| package\\_id | The id of the package that set this attribute. | -| key | The key used by the package to identify this attribute. | -""" -struct t8_stash_attribute - id::t8_gloidx_t - attr_size::Csize_t - attr_data::Ptr{Cvoid} - is_owned::Cint - package_id::Cint - key::Cint -end + If there are no face neighbors, then *neighbor\\_leaves = NULL, num\\_neighbors = 0, and *pelement\\_indices = NULL on output. -"""The attribute information that is stored before a cmesh is committed. The pair (package\\_id, key) serves as a lookup key to identify the data.""" -const t8_stash_attribute_struct_t = t8_stash_attribute +!!! note -"""The stash data structure is used to store information about the cmesh before it is committed. In particular we store the eclasses of the trees, the face-connections and the tree attributes. Using the stash structure allows us to have a very flexible interface. When constructing a new mesh, the user can specify all these mesh entities in arbitrary order. As soon as the cmesh is committed the information is copied from the stash to the cmesh in an order mannered.""" -const t8_stash_struct_t = t8_stash + Currently *forest* must be balanced. -""" - t8_stash_init(pstash) +!!! note -Initialize a stash data structure. + *forest* must be committed before calling this function. -# Arguments -* `pstash`:\\[in,out\\] A pointer to the stash to be initialized. -### Prototype -```c -void t8_stash_init (t8_stash_t *pstash); -``` -""" -function t8_stash_init(pstash) - @ccall libt8.t8_stash_init(pstash::Ptr{t8_stash_t})::Cvoid -end +!!! note -""" - t8_stash_destroy(pstash) + Important! This routine allocates memory which must be freed. Do it like this: -Free all memory associated in a stash structure. +if (num\\_neighbors > 0) { scheme->element\\_destroy (pneigh\\_eclass, num\\_neighbors, pneighbor\\_leaves); [`T8_FREE`](@ref) (pneighbor\\_leaves); [`T8_FREE`](@ref) (pelement\\_indices); [`T8_FREE`](@ref) (dual\\_faces); } # Arguments -* `pstash`:\\[in,out\\] A pointer to the stash to be destroyed. The pointer is set to NULL after the function call. +* `forest`:\\[in\\] The forest. Must have a valid ghost layer. +* `ltreeid`:\\[in\\] A local tree id. +* `leaf`:\\[in\\] A leaf in tree *ltreeid* of *forest*. +* `pneighbor_leaves`:\\[out\\] Unallocated on input. On output the neighbor leaves are stored here. +* `face`:\\[in\\] The index of the face across which the face neighbors are searched. +* `dual_faces`:\\[out\\] On output the face id's of the neighboring elements' faces. +* `num_neighbors`:\\[out\\] On output the number of neighbor leaves. +* `pelement_indices`:\\[out\\] Unallocated on input. On output the element indices of the neighbor leaves are stored here. 0, 1, ... num\\_local\\_el - 1 for local leaves and num\\_local\\_el , ... , num\\_local\\_el + num\\_ghosts - 1 for ghosts. +* `pneigh_eclass`:\\[out\\] On output the eclass of the neighbor elements. +* `forest_is_balanced`:\\[in\\] True if we know that *forest* is balanced, false otherwise. ### Prototype ```c -void t8_stash_destroy (t8_stash_t *pstash); +void t8_forest_leaf_face_neighbors (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *leaf, t8_element_t **pneighbor_leaves[], int face, int *dual_faces[], int *num_neighbors, t8_locidx_t **pelement_indices, t8_eclass_t *pneigh_eclass, int forest_is_balanced); ``` """ -function t8_stash_destroy(pstash) - @ccall libt8.t8_stash_destroy(pstash::Ptr{t8_stash_t})::Cvoid +function t8_forest_leaf_face_neighbors(forest, ltreeid, leaf, pneighbor_leaves, face, dual_faces, num_neighbors, pelement_indices, pneigh_eclass, forest_is_balanced) + @ccall libt8.t8_forest_leaf_face_neighbors(forest::t8_forest_t, ltreeid::t8_locidx_t, leaf::Ptr{t8_element_t}, pneighbor_leaves::Ptr{Ptr{Ptr{t8_element_t}}}, face::Cint, dual_faces::Ptr{Ptr{Cint}}, num_neighbors::Ptr{Cint}, pelement_indices::Ptr{Ptr{t8_locidx_t}}, pneigh_eclass::Ptr{t8_eclass_t}, forest_is_balanced::Cint)::Cvoid end """ - t8_stash_add_class(stash, id, eclass) + t8_forest_leaf_face_neighbors_ext(forest, ltreeid, leaf, pneighbor_leaves, face, dual_faces, num_neighbors, pelement_indices, pneigh_eclass, forest_is_balanced, gneigh_tree, orientation) -Set the eclass of a tree. +Like t8_forest_leaf_face_neighbors but also provides information about the global neighbors and the orientation. -# Arguments -* `stash`:\\[in,out\\] The stash to be updated. -* `id`:\\[in\\] The global id of the tree whose eclass should be set. -* `eclass`:\\[in\\] The eclass of tree with id *id*. -### Prototype -```c -void t8_stash_add_class (t8_stash_t stash, t8_gloidx_t id, t8_eclass_t eclass); -``` -""" -function t8_stash_add_class(stash, id, eclass) - @ccall libt8.t8_stash_add_class(stash::t8_stash_t, id::t8_gloidx_t, eclass::t8_eclass_t)::Cvoid -end +!!! note -""" - t8_stash_add_facejoin(stash, gid1, gid2, face1, face2, orientation) + If there are no face neighbors, then *neighbor\\_leaves = NULL, num\\_neighbors = 0, and *pelement\\_indices = NULL on output. -Add a face connection to a stash. +!!! note -# Arguments -* `stash`:\\[in,out\\] The stash to be updated. -* `id1`:\\[in\\] The global id of the first tree. -* `id2`:\\[in\\] The global id of the second tree, -* `face1`:\\[in\\] The face number of the face of the first tree. -* `face2`:\\[in\\] The face number of the face of the second tree. -* `orientation`:\\[in\\] The orientation of the faces to each other. -### Prototype -```c -void t8_stash_add_facejoin (t8_stash_t stash, t8_gloidx_t gid1, t8_gloidx_t gid2, int face1, int face2, int orientation); -``` -""" -function t8_stash_add_facejoin(stash, gid1, gid2, face1, face2, orientation) - @ccall libt8.t8_stash_add_facejoin(stash::t8_stash_t, gid1::t8_gloidx_t, gid2::t8_gloidx_t, face1::Cint, face2::Cint, orientation::Cint)::Cvoid -end + Currently *forest* must be balanced. -""" - t8_stash_class_sort(stash) +!!! note -Sort the entries in the class array by the order given in the enum definition of [`t8_eclass`](@ref). + *forest* must be committed before calling this function. -# Arguments -* `stash`:\\[in,out\\] The stash whose class array is sorted. -### Prototype -```c -void t8_stash_class_sort (t8_stash_t stash); -``` -""" -function t8_stash_class_sort(stash) - @ccall libt8.t8_stash_class_sort(stash::t8_stash_t)::Cvoid -end +!!! note -""" - t8_stash_class_bsearch(stash, tree_id) + Important! This routine allocates memory which must be freed. Do it like this: -Search for an entry with a given tree index in the class-stash. The stash must be sorted beforehand. +if (num\\_neighbors > 0) { scheme->element\\_destroy (pneigh\\_eclass, num\\_neighbors, pneighbor\\_leaves); [`T8_FREE`](@ref) (pneighbor\\_leaves); [`T8_FREE`](@ref) (pelement\\_indices); [`T8_FREE`](@ref) (dual\\_faces); } # Arguments -* `stash`:\\[in\\] The stash to be searched for. -* `tree_id`:\\[in\\] The global tree id. -# Returns -The index of an element in the classes array of *stash* corresponding to *tree_id*. -1 if not found. +* `forest`:\\[in\\] The forest. Must have a valid ghost layer. +* `ltreeid`:\\[in\\] A local tree id. +* `leaf`:\\[in\\] A leaf in tree *ltreeid* of *forest*. +* `pneighbor_leaves`:\\[out\\] Unallocated on input. On output the neighbor leaves are stored here. +* `face`:\\[in\\] The index of the face across which the face neighbors are searched. +* `dual_faces`:\\[out\\] On output the face id's of the neighboring elements' faces. +* `num_neighbors`:\\[out\\] On output the number of neighbor leaves. +* `pelement_indices`:\\[out\\] Unallocated on input. On output the element indices of the neighbor leaves are stored here. 0, 1, ... num\\_local\\_el - 1 for local leaves and num\\_local\\_el , ... , num\\_local\\_el + num\\_ghosts - 1 for ghosts. +* `pneigh_eclass`:\\[out\\] On output the eclass of the neighbor elements. +* `forest_is_balanced`:\\[in\\] True if we know that *forest* is balanced, false otherwise. +* `gneigh_tree`:\\[out\\] The global tree IDs of the neighbor trees. +* `orientation`:\\[out\\] If not NULL on input, the face orientation is computed and stored here. Thus, if the face connection is an inter-tree connection the orientation of the tree-to-tree connection is stored. Otherwise, the value 0 is stored. All other parameters and behavior are identical to t8_forest_leaf_face_neighbors. ### Prototype ```c -ssize_t t8_stash_class_bsearch (t8_stash_t stash, t8_gloidx_t tree_id); +void t8_forest_leaf_face_neighbors_ext (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *leaf, t8_element_t **pneighbor_leaves[], int face, int *dual_faces[], int *num_neighbors, t8_locidx_t **pelement_indices, t8_eclass_t *pneigh_eclass, int forest_is_balanced, t8_gloidx_t *gneigh_tree, int *orientation); ``` """ -function t8_stash_class_bsearch(stash, tree_id) - @ccall libt8.t8_stash_class_bsearch(stash::t8_stash_t, tree_id::t8_gloidx_t)::Cssize_t +function t8_forest_leaf_face_neighbors_ext(forest, ltreeid, leaf, pneighbor_leaves, face, dual_faces, num_neighbors, pelement_indices, pneigh_eclass, forest_is_balanced, gneigh_tree, orientation) + @ccall libt8.t8_forest_leaf_face_neighbors_ext(forest::t8_forest_t, ltreeid::t8_locidx_t, leaf::Ptr{t8_element_t}, pneighbor_leaves::Ptr{Ptr{Ptr{t8_element_t}}}, face::Cint, dual_faces::Ptr{Ptr{Cint}}, num_neighbors::Ptr{Cint}, pelement_indices::Ptr{Ptr{t8_locidx_t}}, pneigh_eclass::Ptr{t8_eclass_t}, forest_is_balanced::Cint, gneigh_tree::Ptr{t8_gloidx_t}, orientation::Ptr{Cint})::Cvoid end """ - t8_stash_joinface_sort(stash) + t8_forest_ghost_exchange_data(forest, element_data) + +Exchange ghost information of user defined element data. -Sort then entries in the facejoin array in order of the first treeid. +!!! note + + This function is collective and hence must be called by all processes in the forest's MPI Communicator. # Arguments -* `stash`:\\[in,out\\] The stash whose facejoin array is sorted. +* `forest`:\\[in\\] The forest. Must be committed. +* `element_data`:\\[in\\] An array of length num\\_local\\_elements + num\\_ghosts storing one value for each local element and ghost in *forest*. After calling this function the entries for the ghost elements are update with the entries in the *element_data* array of the corresponding owning process. ### Prototype ```c -void t8_stash_joinface_sort (t8_stash_t stash); +void t8_forest_ghost_exchange_data (t8_forest_t forest, sc_array_t *element_data); ``` """ -function t8_stash_joinface_sort(stash) - @ccall libt8.t8_stash_joinface_sort(stash::t8_stash_t)::Cvoid +function t8_forest_ghost_exchange_data(forest, element_data) + @ccall libt8.t8_forest_ghost_exchange_data(forest::t8_forest_t, element_data::Ptr{sc_array_t})::Cvoid end """ - t8_stash_add_attribute(stash, id, package_id, key, size, attr, copy) + t8_forest_ghost_print(forest) -Add an attribute to a tree. +Print the ghost structure of a forest. Only used for debugging. -# Arguments -* `stash`:\\[in\\] The stash structure to be modified. -* `id`:\\[in\\] The global index of the tree to which the attribute is added. -* `package_id`:\\[in\\] The unique id of the current package. -* `key`:\\[in\\] An integer value used to identify this attribute. -* `size`:\\[in\\] The size (in bytes) of the attribute. -* `attr`:\\[in\\] Points to *size* bytes of memory that should be stored as the attribute. -* `copy`:\\[in\\] If true the attribute data is copied from *attr* to an internal storage. If false only the pointer *attr* is stored and the data is only copied if the cmesh is committed. (More memory efficient). ### Prototype ```c -void t8_stash_add_attribute (t8_stash_t stash, t8_gloidx_t id, int package_id, int key, size_t size, void *const attr, int copy); +void t8_forest_ghost_print (t8_forest_t forest); ``` """ -function t8_stash_add_attribute(stash, id, package_id, key, size, attr, copy) - @ccall libt8.t8_stash_add_attribute(stash::t8_stash_t, id::t8_gloidx_t, package_id::Cint, key::Cint, size::Csize_t, attr::Ptr{Cvoid}, copy::Cint)::Cvoid +function t8_forest_ghost_print(forest) + @ccall libt8.t8_forest_ghost_print(forest::t8_forest_t)::Cvoid end """ - t8_stash_get_attribute_size(stash, index) - -Return the size (in bytes) of an attribute in the stash. + t8_forest_partition_cmesh(forest, comm, set_profiling) -# Arguments -* `stash`:\\[in\\] The stash to be considered. -* `index`:\\[in\\] The index of the attribute in the attribute array of *stash*. -# Returns -The size in bytes of the attribute. ### Prototype ```c -size_t t8_stash_get_attribute_size (t8_stash_t stash, size_t index); +void t8_forest_partition_cmesh (t8_forest_t forest, sc_MPI_Comm comm, int set_profiling); ``` """ -function t8_stash_get_attribute_size(stash, index) - @ccall libt8.t8_stash_get_attribute_size(stash::t8_stash_t, index::Csize_t)::Csize_t +function t8_forest_partition_cmesh(forest, comm, set_profiling) + @ccall libt8.t8_forest_partition_cmesh(forest::t8_forest_t, comm::Cint, set_profiling::Cint)::Cvoid end """ - t8_stash_get_attribute(stash, index) - -Return the pointer to an attribute in the stash. + t8_forest_get_mpicomm(forest) -# Arguments -* `stash`:\\[in\\] The stash to be considered. -* `index`:\\[in\\] The index of the attribute in the attribute array of *stash*. -# Returns -A void pointer to the memory region where the attribute is stored. ### Prototype ```c -void * t8_stash_get_attribute (t8_stash_t stash, size_t index); +sc_MPI_Comm t8_forest_get_mpicomm (const t8_forest_t forest); ``` """ -function t8_stash_get_attribute(stash, index) - @ccall libt8.t8_stash_get_attribute(stash::t8_stash_t, index::Csize_t)::Ptr{Cvoid} +function t8_forest_get_mpicomm(forest) + @ccall libt8.t8_forest_get_mpicomm(forest::t8_forest_t)::Cint end """ - t8_stash_get_attribute_tree_id(stash, index) + t8_forest_get_first_local_tree_id(forest) -Return the id of the tree a given attribute belongs to. +Return the global id of the first local tree of a forest. # Arguments -* `stash`:\\[in\\] The stash to be considered. -* `index`:\\[in\\] The index of the attribute in the attribute array of *stash*. +* `forest`:\\[in\\] The forest. # Returns -The tree id. +The global id of the first local tree in *forest*. ### Prototype ```c -t8_gloidx_t t8_stash_get_attribute_tree_id (t8_stash_t stash, size_t index); +t8_gloidx_t t8_forest_get_first_local_tree_id (const t8_forest_t forest); ``` """ -function t8_stash_get_attribute_tree_id(stash, index) - @ccall libt8.t8_stash_get_attribute_tree_id(stash::t8_stash_t, index::Csize_t)::t8_gloidx_t +function t8_forest_get_first_local_tree_id(forest) + @ccall libt8.t8_forest_get_first_local_tree_id(forest::t8_forest_t)::t8_gloidx_t end """ - t8_stash_get_attribute_key(stash, index) + t8_forest_get_num_local_trees(forest) -Return the key of a given attribute. +Return the number of local trees of a given forest. # Arguments -* `stash`:\\[in\\] The stash to be considered. -* `index`:\\[in\\] The index of the attribute in the attribute array of *stash*. +* `forest`:\\[in\\] The forest. # Returns -The attribute's key. +The number of local trees of that forest. ### Prototype ```c -int t8_stash_get_attribute_key (t8_stash_t stash, size_t index); +t8_locidx_t t8_forest_get_num_local_trees (const t8_forest_t forest); ``` """ -function t8_stash_get_attribute_key(stash, index) - @ccall libt8.t8_stash_get_attribute_key(stash::t8_stash_t, index::Csize_t)::Cint +function t8_forest_get_num_local_trees(forest) + @ccall libt8.t8_forest_get_num_local_trees(forest::t8_forest_t)::t8_locidx_t end """ - t8_stash_get_attribute_id(stash, index) + t8_forest_get_num_ghost_trees(forest) -Return the package\\_id of a given attribute. +Return the number of ghost trees of a given forest. # Arguments -* `stash`:\\[in\\] The stash to be considered. -* `index`:\\[in\\] The index of the attribute in the attribute array of *stash*. +* `forest`:\\[in\\] The forest. # Returns -The attribute's package\\_id. +The number of ghost trees of that forest. ### Prototype ```c -int t8_stash_get_attribute_id (t8_stash_t stash, size_t index); +t8_locidx_t t8_forest_get_num_ghost_trees (const t8_forest_t forest); ``` """ -function t8_stash_get_attribute_id(stash, index) - @ccall libt8.t8_stash_get_attribute_id(stash::t8_stash_t, index::Csize_t)::Cint +function t8_forest_get_num_ghost_trees(forest) + @ccall libt8.t8_forest_get_num_ghost_trees(forest::t8_forest_t)::t8_locidx_t end """ - t8_stash_attribute_is_owned(stash, index) + t8_forest_get_num_global_trees(forest) -Return true if an attribute in the stash is owned by the stash, that is, it was copied in the call to [`t8_stash_add_attribute`](@ref). Returns false if the attribute is not owned by the stash. +Return the number of global trees of a given forest. # Arguments -* `stash`:\\[in\\] The stash to be considered. -* `index`:\\[in\\] The index of the attribute in the attribute array of *stash*. +* `forest`:\\[in\\] The forest. # Returns -True of false. +The number of global trees of that forest. ### Prototype ```c -int t8_stash_attribute_is_owned (t8_stash_t stash, size_t index); +t8_gloidx_t t8_forest_get_num_global_trees (const t8_forest_t forest); ``` """ -function t8_stash_attribute_is_owned(stash, index) - @ccall libt8.t8_stash_attribute_is_owned(stash::t8_stash_t, index::Csize_t)::Cint +function t8_forest_get_num_global_trees(forest) + @ccall libt8.t8_forest_get_num_global_trees(forest::t8_forest_t)::t8_gloidx_t end """ - t8_stash_attribute_sort(stash) + t8_forest_global_tree_id(forest, ltreeid) -Sort the attributes array of a stash in the order (treeid, package_id, key) * +Return the global id of a local tree or a ghost tree. # Arguments -* `stash`:\\[in,out\\] The stash to be considered. -### Prototype -```c -void t8_stash_attribute_sort (t8_stash_t stash); -``` -""" -function t8_stash_attribute_sort(stash) - @ccall libt8.t8_stash_attribute_sort(stash::t8_stash_t)::Cvoid -end - -""" - t8_stash_bcast(stash, root, comm, elem_counts) +* `forest`:\\[in\\] The forest. +* `ltreeid`:\\[in\\] An id 0 <= *ltreeid* < num\\_local\\_trees + num\\_ghosts specifying a local tree or ghost tree. +# Returns +The global id corresponding to the tree with local id *ltreeid*. *forest* must be committed before calling this function. +# See also +https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. ### Prototype ```c -t8_stash_t t8_stash_bcast (t8_stash_t stash, int root, sc_MPI_Comm comm, const size_t elem_counts[3]); +t8_gloidx_t t8_forest_global_tree_id (const t8_forest_t forest, const t8_locidx_t ltreeid); ``` """ -function t8_stash_bcast(stash, root, comm, elem_counts) - @ccall libt8.t8_stash_bcast(stash::t8_stash_t, root::Cint, comm::MPI_Comm, elem_counts::Ptr{Csize_t})::t8_stash_t +function t8_forest_global_tree_id(forest, ltreeid) + @ccall libt8.t8_forest_global_tree_id(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_gloidx_t end """ - t8_stash_is_equal(stash_a, stash_b) + t8_forest_get_tree(forest, ltree_id) -Check two stashes for equal content and return true if so. +Return a pointer to a tree in a forest. # Arguments -* `stash_a`:\\[in\\] The first stash to be considered. -* `stash_b`:\\[in\\] The first stash to be considered. +* `forest`:\\[in\\] The forest. +* `ltree_id`:\\[in\\] The local id of the tree. # Returns -True if both stashes hold copies of the same data. False otherwise. +A pointer to the tree with local id *ltree_id*. *forest* must be committed before calling this function. ### Prototype ```c -int t8_stash_is_equal (t8_stash_t stash_a, t8_stash_t stash_b); +t8_tree_t t8_forest_get_tree (const t8_forest_t forest, const t8_locidx_t ltree_id); ``` """ -function t8_stash_is_equal(stash_a, stash_b) - @ccall libt8.t8_stash_is_equal(stash_a::t8_stash_t, stash_b::t8_stash_t)::Cint -end - -""" - t8_attribute_info - -This structure holds the information associated to an attribute of a tree. The attributes of each are stored in a key-value storage, where the key consists of the two entries (package\\_id,key) both being integers. The package\\_id serves to identify the application layer that added the attribute and the key identifies the attribute within that application layer. - -All attribute info objects of one tree are stored in an array and adding a tree's att\\_offset entry to the tree's address yields this array. The attributes themselves are stored in an array directly behind the array of the attribute infos. -""" -struct t8_attribute_info - package_id::Cint - key::Cint - attribute_offset::Csize_t - attribute_size::Csize_t -end - -""" -This structure holds the information associated to an attribute of a tree. The attributes of each are stored in a key-value storage, where the key consists of the two entries (package\\_id,key) both being integers. The package\\_id serves to identify the application layer that added the attribute and the key identifies the attribute within that application layer. - -All attribute info objects of one tree are stored in an array and adding a tree's att\\_offset entry to the tree's address yields this array. The attributes themselves are stored in an array directly behind the array of the attribute infos. -""" -const t8_attribute_info_struct_t = t8_attribute_info - -""" - t8_trees_glo_lo_hash_t - -This struct is an entry of the trees global\\_id to local\\_id hash table for ghost trees. - -| Field | Note | -| :---------- | :------------- | -| global\\_id | The global id | -| local\\_id | The local id | -""" -struct t8_trees_glo_lo_hash_t - global_id::t8_gloidx_t - local_id::t8_locidx_t +function t8_forest_get_tree(forest, ltree_id) + @ccall libt8.t8_forest_get_tree(forest::t8_forest_t, ltree_id::t8_locidx_t)::t8_tree_t end """ - t8_cmesh_trees_init(ptrees, num_procs, num_trees, num_ghosts) + t8_forest_get_tree_vertices(forest, ltreeid) -Initialize a trees structure and allocate its parts. This function allocates the from\\_procs array without filling it, it also allocates the tree\\_to\\_proc and ghost\\_to\\_proc arrays. No memory for trees or ghosts is allocated. +Return a pointer to the vertex coordinates of a tree. # Arguments -* `[in,ou`: ptrees The trees structure to be initialized. -* `num_procs`:\\[in\\] The number of entries of its from\\_proc array (can be different for each process). -* `num_trees`:\\[in\\] The number of trees that will be stored in this structure. -* `num_ghosts`:\\[in\\] The number of ghosts that will be stored in this structure. +* `forest`:\\[in\\] The forest. +* `ltreeid`:\\[in\\] The id of a local tree. +# Returns +If stored, a pointer to the vertex coordinates of *tree*. If no coordinates for this tree are found, NULL. ### Prototype ```c -void t8_cmesh_trees_init (t8_cmesh_trees_t *ptrees, int num_procs, t8_locidx_t num_trees, t8_locidx_t num_ghosts); +double * t8_forest_get_tree_vertices (t8_forest_t forest, t8_locidx_t ltreeid); ``` """ -function t8_cmesh_trees_init(ptrees, num_procs, num_trees, num_ghosts) - @ccall libt8.t8_cmesh_trees_init(ptrees::Ptr{t8_cmesh_trees_t}, num_procs::Cint, num_trees::t8_locidx_t, num_ghosts::t8_locidx_t)::Cvoid -end - -struct t8_part_tree - first_tree::Cstring - first_tree_id::t8_locidx_t - first_ghost_id::t8_locidx_t - num_trees::t8_locidx_t - num_ghosts::t8_locidx_t +function t8_forest_get_tree_vertices(forest, ltreeid) + @ccall libt8.t8_forest_get_tree_vertices(forest::t8_forest_t, ltreeid::t8_locidx_t)::Ptr{Cdouble} end """ -` t8_cmesh_types.h` - -We define here the datatypes needed for internal cmesh routines. -""" -const t8_part_tree_t = Ptr{t8_part_tree} - -""" - t8_cmesh_trees_get_part(trees, proc) + t8_forest_tree_get_leaf_elements(forest, ltree_id) -Return one part of a specified tree array. +Return the array of leaf elements of a local tree in a forest. # Arguments -* `trees`:\\[in\\] The tree array to be queried -* `proc`:\\[in\\] An index specifying the part to be returned. +* `forest`:\\[in\\] The forest. +* `ltree_id`:\\[in\\] The local id of a local tree of *forest*. # Returns -The part number *proc* of *trees*. +An array of [`t8_element_t`](@ref) * storing all leaf elements of this tree. ### Prototype ```c -t8_part_tree_t t8_cmesh_trees_get_part (const t8_cmesh_trees_t trees, const int proc); +t8_element_array_t * t8_forest_tree_get_leaf_elements (const t8_forest_t forest, const t8_locidx_t ltree_id); ``` """ -function t8_cmesh_trees_get_part(trees, proc) - @ccall libt8.t8_cmesh_trees_get_part(trees::t8_cmesh_trees_t, proc::Cint)::t8_part_tree_t +function t8_forest_tree_get_leaf_elements(forest, ltree_id) + @ccall libt8.t8_forest_tree_get_leaf_elements(forest::t8_forest_t, ltree_id::t8_locidx_t)::Ptr{t8_element_array_t} end """ - t8_cmesh_trees_start_part(trees, proc, lfirst_tree, num_trees, lfirst_ghost, num_ghosts, alloc) + t8_forest_get_cmesh(forest) -Allocate the first\\_tree array of a given tree\\_part in a tree struct with a given number of trees and ghosts. This function allocates the memory for the trees and the ghosts but not for their face neighbor entries or attributes. These must be allocated later when the eclasses of the trees and ghosts are known t8_cmesh_trees_finish_part. +Return a cmesh associated to a forest. # Arguments -* `trees`:\\[in,out\\] The trees structure to be updated. -* `proc`:\\[in\\] The index of the part to be updated. -* `lfirst_tree`:\\[in\\] The local id of the first tree of that part. -* `num_trees`:\\[in\\] The number of trees of that part. -* `lfirst_ghost`:\\[in\\] The local id of the first ghost of that part. -* `num_ghosts`:\\[in\\] The number of ghosts of that part. -* `alloc`:\\[in\\] If true then the first\\_tree array is allocated for the number of trees and ghosts. When a cmesh is copied we do not want this, so in we pass alloc = 0 then. +* `forest`:\\[in\\] The forest. +# Returns +The cmesh associated to the forest. ### Prototype ```c -void t8_cmesh_trees_start_part (t8_cmesh_trees_t trees, int proc, t8_locidx_t lfirst_tree, t8_locidx_t num_trees, t8_locidx_t lfirst_ghost, t8_locidx_t num_ghosts, int alloc); +t8_cmesh_t t8_forest_get_cmesh (t8_forest_t forest); ``` """ -function t8_cmesh_trees_start_part(trees, proc, lfirst_tree, num_trees, lfirst_ghost, num_ghosts, alloc) - @ccall libt8.t8_cmesh_trees_start_part(trees::t8_cmesh_trees_t, proc::Cint, lfirst_tree::t8_locidx_t, num_trees::t8_locidx_t, lfirst_ghost::t8_locidx_t, num_ghosts::t8_locidx_t, alloc::Cint)::Cvoid +function t8_forest_get_cmesh(forest) + @ccall libt8.t8_forest_get_cmesh(forest::t8_forest_t)::t8_cmesh_t end """ - t8_cmesh_trees_finish_part(trees, proc) + t8_forest_get_leaf_element(forest, lelement_id, ltreeid) -After all classes of trees and ghosts have been set and after the number of tree attributes was set and their total size (per tree) stored temporarily in the att\\_offset variable we grow the part array by the needed amount of memory and set the offsets appropriately. The workflow should be: call t8_cmesh_trees_start_part, set tree and ghost classes manually via t8_cmesh_trees_add_tree and t8_cmesh_trees_add_ghost, call t8_cmesh_trees_init_attributes, then call this function. Afterwards successively call t8_cmesh_trees_add_attribute for each attribute and also set all face neighbors (TODO: write function). - -# Arguments -* `trees`:\\[in,out\\] The trees structure to be updated. -* `proc`:\\[in\\] The number of the part to be finished. -### Prototype -```c -void t8_cmesh_trees_finish_part (t8_cmesh_trees_t trees, int proc); -``` -""" -function t8_cmesh_trees_finish_part(trees, proc) - @ccall libt8.t8_cmesh_trees_finish_part(trees::t8_cmesh_trees_t, proc::Cint)::Cvoid -end +Return a leaf element of the forest. -""" - t8_cmesh_trees_copy_toproc(trees_dest, trees_src, lnum_trees, lnum_ghosts) +!!! note -Copy the tree\\_to\\_proc and ghost\\_to\\_proc arrays of one tree structure to another one. + This function performs a binary search. For constant access, use t8_forest_get_leaf_element_in_tree *forest* must be committed before calling this function. # Arguments -* `trees_dest`:\\[in,out\\] The destination trees structure. -* `trees_src`:\\[in\\] The source trees structure. -* `lnum_trees`:\\[in\\] The total number of trees stored in *trees_src*. -* `lnum_ghosts`:\\[in\\] The total number of ghosts stored in *trees_src*. +* `forest`:\\[in\\] The forest. +* `lelement_id`:\\[in\\] The local id of a leaf element in *forest*. +* `ltreeid`:\\[out\\] If not NULL, on output the local tree id of the tree in which the leaf element lies in. +# Returns +A pointer to the leaf element. NULL if this element does not exist. Ghost elements are not considered as local. +# See also +[`t8_forest_ghost_get_leaf_element`](@ref) to access ghost leaf elements. + ### Prototype ```c -void t8_cmesh_trees_copy_toproc (t8_cmesh_trees_t trees_dest, t8_cmesh_trees_t trees_src, t8_locidx_t lnum_trees, t8_locidx_t lnum_ghosts); +t8_element_t * t8_forest_get_leaf_element (t8_forest_t forest, t8_locidx_t lelement_id, t8_locidx_t *ltreeid); ``` """ -function t8_cmesh_trees_copy_toproc(trees_dest, trees_src, lnum_trees, lnum_ghosts) - @ccall libt8.t8_cmesh_trees_copy_toproc(trees_dest::t8_cmesh_trees_t, trees_src::t8_cmesh_trees_t, lnum_trees::t8_locidx_t, lnum_ghosts::t8_locidx_t)::Cvoid +function t8_forest_get_leaf_element(forest, lelement_id, ltreeid) + @ccall libt8.t8_forest_get_leaf_element(forest::t8_forest_t, lelement_id::t8_locidx_t, ltreeid::Ptr{t8_locidx_t})::Ptr{t8_element_t} end """ - t8_cmesh_trees_copy_part(trees_dest, part_dest, trees_src, part_src) - -Copy the trees array from one part to another. + t8_forest_get_leaf_element_in_tree(forest, ltreeid, leid_in_tree) -# Arguments -* `trees_dest`:\\[in,out\\] The trees struct of the destination part. -* `part_dest`:\\[in\\] The index of the destination part. Must be initialized by t8_cmesh_trees_start_part with alloc = 0. -* `trees_src`:\\[in\\] The trees struct of the source part. -* `part_src`:\\[in\\] The index of the destination part. Must be a valid part, thus t8_cmesh_trees_finish_part must have been called. -### Prototype -```c -void t8_cmesh_trees_copy_part (t8_cmesh_trees_t trees_dest, int part_dest, t8_cmesh_trees_t trees_src, int part_src); -``` -""" -function t8_cmesh_trees_copy_part(trees_dest, part_dest, trees_src, part_src) - @ccall libt8.t8_cmesh_trees_copy_part(trees_dest::t8_cmesh_trees_t, part_dest::Cint, trees_src::t8_cmesh_trees_t, part_src::Cint)::Cvoid -end +Return a leaf element of a local tree in a forest. -""" - t8_cmesh_trees_add_tree(trees, ltree_id, proc, eclass) +!!! note -Add a tree to a trees structure. + If the tree id is know, this function should be preferred over t8_forest_get_leaf_element. *forest* must be committed before calling this function. # Arguments -* `trees`:\\[in,out\\] The trees structure to be updated. -* `tree_id`:\\[in\\] The local id of the tree to be inserted. -* `proc`:\\[in\\] The mpirank of the process from which the tree was received. -* `eclass`:\\[in\\] The tree's element class. +* `forest`:\\[in\\] The forest. +* `ltreeid`:\\[in\\] An id of a local tree in the forest. Ghost trees are not considered local. +* `leid_in_tree`:\\[in\\] The index of a leaf element in the tree. +# Returns +A pointer to the leaf element. +# See also +t8\\_forest\\_ghost\\_get\\_leaf\\_element\\_in\\_tree to access ghost leaf elements. + ### Prototype ```c -void t8_cmesh_trees_add_tree (t8_cmesh_trees_t trees, t8_locidx_t ltree_id, int proc, t8_eclass_t eclass); +const t8_element_t * t8_forest_get_leaf_element_in_tree (t8_forest_t forest, t8_locidx_t ltreeid, t8_locidx_t leid_in_tree); ``` """ -function t8_cmesh_trees_add_tree(trees, ltree_id, proc, eclass) - @ccall libt8.t8_cmesh_trees_add_tree(trees::t8_cmesh_trees_t, ltree_id::t8_locidx_t, proc::Cint, eclass::t8_eclass_t)::Cvoid +function t8_forest_get_leaf_element_in_tree(forest, ltreeid, leid_in_tree) + @ccall libt8.t8_forest_get_leaf_element_in_tree(forest::t8_forest_t, ltreeid::t8_locidx_t, leid_in_tree::t8_locidx_t)::Ptr{t8_element_t} end """ - t8_cmesh_trees_add_ghost(trees, lghost_index, gtree_id, proc, eclass, num_local_trees) + t8_forest_get_tree_num_leaf_elements(forest, ltreeid) -Add a ghost to a trees structure. +Return the number of leaf elements of a tree. # Arguments -* `trees`:\\[in,out\\] The trees structure to be updated. -* `ghost_index`:\\[in\\] The index in the part array of the ghost to be inserted. -* `tree_id`:\\[in\\] The global index of the ghost. -* `proc`:\\[in\\] The mpirank of the process from which the ghost was received. -* `eclass`:\\[in\\] The ghost's element class. -* `num_local_trees`:\\[in\\] The number of local trees in the cmesh. +* `forest`:\\[in\\] The forest. +* `ltreeid`:\\[in\\] A local id of a tree. +# Returns +The number of leaf elements in the local tree *ltreeid*. ### Prototype ```c -void t8_cmesh_trees_add_ghost (t8_cmesh_trees_t trees, t8_locidx_t lghost_index, t8_gloidx_t gtree_id, int proc, t8_eclass_t eclass, t8_locidx_t num_local_trees); +t8_locidx_t t8_forest_get_tree_num_leaf_elements (t8_forest_t forest, t8_locidx_t ltreeid); ``` """ -function t8_cmesh_trees_add_ghost(trees, lghost_index, gtree_id, proc, eclass, num_local_trees) - @ccall libt8.t8_cmesh_trees_add_ghost(trees::t8_cmesh_trees_t, lghost_index::t8_locidx_t, gtree_id::t8_gloidx_t, proc::Cint, eclass::t8_eclass_t, num_local_trees::t8_locidx_t)::Cvoid +function t8_forest_get_tree_num_leaf_elements(forest, ltreeid) + @ccall libt8.t8_forest_get_tree_num_leaf_elements(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_locidx_t end """ - t8_cmesh_trees_set_all_boundary(cmesh, trees) + t8_forest_get_tree_element_offset(forest, ltreeid) -Set all neighbor fields of all local trees and ghosts to boundary. +Return the element offset of a local tree, that is the number of leaf elements in all trees with smaller local treeid. -# Arguments -* `cmesh,`:\\[in,out\\] The associated cmesh. -* `trees,`:\\[in,out\\] The trees structure. A face f of tree t counts as boundary if the face-neighbor is also t at face f. -### Prototype -```c -void t8_cmesh_trees_set_all_boundary (t8_cmesh_t cmesh, t8_cmesh_trees_t trees); -``` -""" -function t8_cmesh_trees_set_all_boundary(cmesh, trees) - @ccall libt8.t8_cmesh_trees_set_all_boundary(cmesh::t8_cmesh_t, trees::t8_cmesh_trees_t)::Cvoid -end +!!! note -""" - t8_cmesh_trees_get_part_data(trees, proc, first_tree, num_trees, first_ghost, num_ghosts) + *forest* must be committed before calling this function. +# Arguments +* `forest`:\\[in\\] The forest. +* `ltreeid`:\\[in\\] A local id of a tree. +# Returns +The number of leaf elements on all local tree with id < *ltreeid*. ### Prototype ```c -void t8_cmesh_trees_get_part_data (t8_cmesh_trees_t trees, int proc, t8_locidx_t *first_tree, t8_locidx_t *num_trees, t8_locidx_t *first_ghost, t8_locidx_t *num_ghosts); +t8_locidx_t t8_forest_get_tree_element_offset (const t8_forest_t forest, const t8_locidx_t ltreeid); ``` """ -function t8_cmesh_trees_get_part_data(trees, proc, first_tree, num_trees, first_ghost, num_ghosts) - @ccall libt8.t8_cmesh_trees_get_part_data(trees::t8_cmesh_trees_t, proc::Cint, first_tree::Ptr{t8_locidx_t}, num_trees::Ptr{t8_locidx_t}, first_ghost::Ptr{t8_locidx_t}, num_ghosts::Ptr{t8_locidx_t})::Cvoid +function t8_forest_get_tree_element_offset(forest, ltreeid) + @ccall libt8.t8_forest_get_tree_element_offset(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_locidx_t end """ - t8_cmesh_trees_get_tree(trees, ltree) + t8_forest_get_tree_leaf_element_count(tree) -Return a pointer to a specific tree in a trees struct. +Return the number of leaf elements of a tree. # Arguments -* `trees`:\\[in\\] The tress structure where the tree is to be looked up. -* `ltree`:\\[in\\] The local id of the tree. +* `tree`:\\[in\\] A tree in a forest. # Returns -A pointer to the tree with local id *tree*. +The number of leaf elements of that tree. ### Prototype ```c -t8_ctree_t t8_cmesh_trees_get_tree (t8_cmesh_trees_t trees, t8_locidx_t ltree); +t8_locidx_t t8_forest_get_tree_leaf_element_count (t8_tree_t tree); ``` """ -function t8_cmesh_trees_get_tree(trees, ltree) - @ccall libt8.t8_cmesh_trees_get_tree(trees::t8_cmesh_trees_t, ltree::t8_locidx_t)::t8_ctree_t +function t8_forest_get_tree_leaf_element_count(tree) + @ccall libt8.t8_forest_get_tree_leaf_element_count(tree::t8_tree_t)::t8_locidx_t end """ - t8_cmesh_trees_get_tree_ext(trees, ltree_id, face_neigh, ttf) + t8_forest_get_tree_class(forest, ltreeid) -Return a pointer to a specific tree in a trees struct plus pointers to its face\\_neighbor and tree\\_to\\_face arrays. +Return the eclass of a tree in a forest. # Arguments -* `trees`:\\[in\\] The trees structure where the tree is to be looked up. -* `ltree_id`:\\[in\\] The local id of the tree. -* `face_neigh`:\\[out\\] If not NULL a pointer to the trees face\\_neighbor array is stored here on return. -* `ttf`:\\[out\\] If not NULL a pointer to the trees tree\\_to\\_face array is stored here on return. +* `forest`:\\[in\\] The forest. +* `ltreeid`:\\[in\\] The local id of a tree (local or ghost) in *forest*. # Returns -A pointer to the tree with local id *tree*. +The element class of the tree with local id *ltreeid*. ### Prototype ```c -t8_ctree_t t8_cmesh_trees_get_tree_ext (t8_cmesh_trees_t trees, t8_locidx_t ltree_id, t8_locidx_t **face_neigh, int8_t **ttf); +t8_eclass_t t8_forest_get_tree_class (const t8_forest_t forest, const t8_locidx_t ltreeid); ``` """ -function t8_cmesh_trees_get_tree_ext(trees, ltree_id, face_neigh, ttf) - @ccall libt8.t8_cmesh_trees_get_tree_ext(trees::t8_cmesh_trees_t, ltree_id::t8_locidx_t, face_neigh::Ptr{Ptr{t8_locidx_t}}, ttf::Ptr{Ptr{Int8}})::t8_ctree_t +function t8_forest_get_tree_class(forest, ltreeid) + @ccall libt8.t8_forest_get_tree_class(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_eclass_t end """ - t8_cmesh_trees_get_face_info(trees, ltreeid, face, ttf) + t8_forest_get_first_local_leaf_element_id(forest) -Return the face neighbor of a tree at a given face and return the tree\\_to\\_face info +Compute the global index of the first local leaf element of a forest. This function is collective. # Arguments -* `trees`:\\[in\\] The trees structure where the tree is to be looked up. -* `ltreeid`:\\[in\\] The local id of the tree. -* `face`:\\[in\\] A face of the tree. -* `ttf`:\\[out\\] If not NULL the tree\\_to\\_face value of the face connection. +* `forest`:\\[in\\] A committed forest, whose first leaf element's index is computed. # Returns -The face neighbor that is stored for this face +The global index of *forest*'s first local leaf element. Forest must be committed when calling this function. This function is collective and must be called on each process. ### Prototype ```c -t8_locidx_t t8_cmesh_trees_get_face_info (t8_cmesh_trees_t trees, t8_locidx_t ltreeid, int face, int8_t *ttf); +t8_gloidx_t t8_forest_get_first_local_leaf_element_id (t8_forest_t forest); ``` """ -function t8_cmesh_trees_get_face_info(trees, ltreeid, face, ttf) - @ccall libt8.t8_cmesh_trees_get_face_info(trees::t8_cmesh_trees_t, ltreeid::t8_locidx_t, face::Cint, ttf::Ptr{Int8})::t8_locidx_t +function t8_forest_get_first_local_leaf_element_id(forest) + @ccall libt8.t8_forest_get_first_local_leaf_element_id(forest::t8_forest_t)::t8_gloidx_t end """ - t8_cmesh_trees_get_face_neighbor(tree, face) + t8_forest_get_scheme(forest) -Given a coarse tree and a face number, return the local id of the neighbor tree. +Return the element scheme associated to a forest. # Arguments -* `tree.`:\\[in\\] The coarse tree. -* `face.`:\\[in\\] The face number. +* `forest`:\\[in\\] A committed forest. # Returns -The local id of the neighbor tree. +The element scheme of the forest. +# See also +[`t8_forest_set_scheme`](@ref) + ### Prototype ```c -t8_locidx_t t8_cmesh_trees_get_face_neighbor (const t8_ctree_t tree, const int face); +const t8_scheme_c * t8_forest_get_scheme (const t8_forest_t forest); ``` """ -function t8_cmesh_trees_get_face_neighbor(tree, face) - @ccall libt8.t8_cmesh_trees_get_face_neighbor(tree::t8_ctree_t, face::Cint)::t8_locidx_t +function t8_forest_get_scheme(forest) + @ccall libt8.t8_forest_get_scheme(forest::t8_forest_t)::Ptr{t8_scheme_c} end """ - t8_cmesh_trees_get_face_neighbor_ext(tree, face, ttf) + t8_forest_element_neighbor_eclass(forest, ltreeid, elem, face) -Given a coarse tree and a face number, return the local id of the neighbor tree together with its tree-to-face info. +Return the eclass of the tree in which a face neighbor of a given element lies. # Arguments -* `tree`:\\[in\\] The coarse tree. -* `face`:\\[in\\] The face number. -* `ttf`:\\[out\\] If not NULL it is filled with the tree-to-face value for this face. +* `forest`:\\[in\\] A committed forest. +* `ltreeid`:\\[in\\] The local tree in which the element lies. +* `elem`:\\[in\\] An element in the tree *ltreeid*. +* `face`:\\[in\\] A face number of *elem*. # Returns -The local id of the neighbor tree. +The local tree id of the tree in which the face neighbor of *elem* across *face* lies. ### Prototype ```c -t8_locidx_t t8_cmesh_trees_get_face_neighbor_ext (const t8_ctree_t tree, const int face, int8_t *ttf); +t8_eclass_t t8_forest_element_neighbor_eclass (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem, int face); ``` """ -function t8_cmesh_trees_get_face_neighbor_ext(tree, face, ttf) - @ccall libt8.t8_cmesh_trees_get_face_neighbor_ext(tree::t8_ctree_t, face::Cint, ttf::Ptr{Int8})::t8_locidx_t +function t8_forest_element_neighbor_eclass(forest, ltreeid, elem, face) + @ccall libt8.t8_forest_element_neighbor_eclass(forest::t8_forest_t, ltreeid::t8_locidx_t, elem::Ptr{t8_element_t}, face::Cint)::t8_eclass_t end """ - t8_cmesh_trees_get_ghost_face_neighbor_ext(ghost, face, ttf) + t8_forest_element_face_neighbor(forest, ltreeid, elem, neigh, neigh_eclass, face, neigh_face) -Given a coarse ghost and a face number, return the local id of the neighbor tree together with its tree-to-face info. +Construct the face neighbor of an element, possibly across tree boundaries. Returns the global tree-id of the tree in which the neighbor element lies in. # Arguments -* `ghost`:\\[in\\] The coarse ghost. -* `face`:\\[in\\] The face number. -* `ttf`:\\[out\\] If not NULL it is filled with the tree-to-face value for this face. +* `forest`:\\[in\\] The forest. +* `ltreeid`:\\[in\\] The local tree in which the element lies. +* `elem`:\\[in\\] The element to be considered. +* `neigh`:\\[in,out\\] On input an allocated element of the scheme of the face\\_neighbors eclass. On output, this element's data is filled with the data of the face neighbor. If the neighbor does not exist the data could be modified arbitrarily. +* `neigh_eclass`:\\[in\\] The eclass of *neigh*. +* `face`:\\[in\\] The number of the face along which the neighbor should be constructed. +* `neigh_face`:\\[out\\] The number of the face viewed from perspective of *neigh*. # Returns -The global id of the neighbor tree. +The global tree-id of the tree in which *neigh* is in. -1 if there exists no neighbor across that face. ### Prototype ```c -t8_gloidx_t t8_cmesh_trees_get_ghost_face_neighbor_ext (const t8_cghost_t ghost, const int face, int8_t *ttf); +t8_gloidx_t t8_forest_element_face_neighbor (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem, t8_element_t *neigh, const t8_eclass_t neigh_eclass, int face, int *neigh_face); ``` """ -function t8_cmesh_trees_get_ghost_face_neighbor_ext(ghost, face, ttf) - @ccall libt8.t8_cmesh_trees_get_ghost_face_neighbor_ext(ghost::t8_cghost_t, face::Cint, ttf::Ptr{Int8})::t8_gloidx_t +function t8_forest_element_face_neighbor(forest, ltreeid, elem, neigh, neigh_eclass, face, neigh_face) + @ccall libt8.t8_forest_element_face_neighbor(forest::t8_forest_t, ltreeid::t8_locidx_t, elem::Ptr{t8_element_t}, neigh::Ptr{t8_element_t}, neigh_eclass::t8_eclass_t, face::Cint, neigh_face::Ptr{Cint})::t8_gloidx_t end """ - t8_cmesh_trees_get_ghost(trees, lghost) + t8_forest_iterate(forest) -Return a pointer to a specific ghost in a trees struct. +TODO: Can be removed since it is unused. # Arguments -* `trees`:\\[in\\] The tress structure where the tree is to be looked up. -* `lghost`:\\[in\\] The local id of the ghost. -# Returns -A pointer to the ghost with local id *ghost*. +* `forest`:\\[in\\] The forest. ### Prototype ```c -t8_cghost_t t8_cmesh_trees_get_ghost (t8_cmesh_trees_t trees, t8_locidx_t lghost); +void t8_forest_iterate (t8_forest_t forest); ``` """ -function t8_cmesh_trees_get_ghost(trees, lghost) - @ccall libt8.t8_cmesh_trees_get_ghost(trees::t8_cmesh_trees_t, lghost::t8_locidx_t)::t8_cghost_t +function t8_forest_iterate(forest) + @ccall libt8.t8_forest_iterate(forest::t8_forest_t)::Cvoid end """ - t8_cmesh_trees_get_ghost_ext(trees, lghost_id, face_neigh, ttf) + t8_forest_element_points_inside(forest, ltreeid, element, points, num_points, is_inside, tolerance) -Return a pointer to a specific ghost in a trees struct plus pointers to its face\\_neighbor and tree\\_to\\_face arrays. +Query whether a batch of points lies inside an element. For bilinearly interpolated elements. + +!!! note + + For 2D quadrilateral elements this function is only an approximation. It is correct if the four vertices lie in the same plane, but it may produce only approximate results if the vertices do not lie in the same plane. # Arguments -* `trees`:\\[in\\] The trees structure where the ghost is to be looked up. -* `lghost_id`:\\[in\\] The local id of the ghost. -* `face_neigh`:\\[out\\] If not NULL a pointer to the ghosts face\\_neighbor array is stored here on return. -* `ttf`:\\[out\\] If not NULL a pointer to the ghosts tree\\_to\\_face array is stored here on return. -# Returns -A pointer to the tree with local id *tree*. +* `forest`:\\[in\\] The forest. +* `ltreeid`:\\[in\\] The forest local id of the tree in which the element is. +* `element`:\\[in\\] The element. +* `points`:\\[in\\] 3-dimensional coordinates of the points to check +* `num_points`:\\[in\\] The number of points to check +* `is_inside`:\\[in,out\\] An array of length *num_points*, filled with 0/1 on output. True (non-zero) if a *point* lies within an *element*, false otherwise. The return value is also true if the point lies on the element boundary. Thus, this function may return true for different leaf elements, if they are neighbors and the point lies on the common boundary. +* `tolerance`:\\[in\\] Tolerance that we allow the point to not exactly match the element. If this value is larger we detect more points. If it is zero we probably do not detect points even if they are inside due to rounding errors. ### Prototype ```c -t8_cghost_t t8_cmesh_trees_get_ghost_ext (t8_cmesh_trees_t trees, t8_locidx_t lghost_id, t8_gloidx_t **face_neigh, int8_t **ttf); +void t8_forest_element_points_inside (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *points, int num_points, int *is_inside, const double tolerance); ``` """ -function t8_cmesh_trees_get_ghost_ext(trees, lghost_id, face_neigh, ttf) - @ccall libt8.t8_cmesh_trees_get_ghost_ext(trees::t8_cmesh_trees_t, lghost_id::t8_locidx_t, face_neigh::Ptr{Ptr{t8_gloidx_t}}, ttf::Ptr{Ptr{Int8}})::t8_cghost_t +function t8_forest_element_points_inside(forest, ltreeid, element, points, num_points, is_inside, tolerance) + @ccall libt8.t8_forest_element_points_inside(forest::t8_forest_t, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, points::Ptr{Cdouble}, num_points::Cint, is_inside::Ptr{Cint}, tolerance::Cdouble)::Cvoid end """ - t8_cmesh_trees_get_ghost_local_id(trees, global_id) + t8_forest_element_find_owner(forest, gtreeid, element, eclass) + +Find the owner process of a given element. -Given the global tree id of a ghost tree in a trees structure, return its local ghost id. +!!! note + + The element must not exist in the forest, but an ancestor of its first descendant has to. If the element's owner is not unique, the owner of the element's first descendant is returned. + +!!! note + + *forest* must be committed before calling this function. # Arguments -* `trees`:\\[in\\] The trees structure. -* `global_id`:\\[in\\] A global tree id. +* `forest`:\\[in\\] The forest. +* `gtreeid`:\\[in\\] The global id of the tree in which the element lies. +* `element`:\\[in\\] The element to look for. +* `eclass`:\\[in\\] The element class of the tree *gtreeid*. # Returns -The local id of the tree *global_id* if it is a ghost in *trees*. A negative number if it isn't. The local id is a number l with num\\_local\\_trees <= *l* < num\\_local\\_trees + num\\_ghosts +The mpirank of the process that owns *element*. +# See also +t8\\_forest\\_element\\_find\\_owner\\_ext, t8\\_forest\\_element\\_owners\\_bounds + ### Prototype ```c -t8_locidx_t t8_cmesh_trees_get_ghost_local_id (t8_cmesh_trees_t trees, t8_gloidx_t global_id); +int t8_forest_element_find_owner (t8_forest_t forest, t8_gloidx_t gtreeid, t8_element_t *element, t8_eclass_t eclass); ``` """ -function t8_cmesh_trees_get_ghost_local_id(trees, global_id) - @ccall libt8.t8_cmesh_trees_get_ghost_local_id(trees::t8_cmesh_trees_t, global_id::t8_gloidx_t)::t8_locidx_t +function t8_forest_element_find_owner(forest, gtreeid, element, eclass) + @ccall libt8.t8_forest_element_find_owner(forest::t8_forest_t, gtreeid::t8_gloidx_t, element::Ptr{t8_element_t}, eclass::t8_eclass_t)::Cint end """ - t8_cmesh_trees_size(trees) + t8_forest_new_uniform(cmesh, scheme, level, do_face_ghost, comm) ### Prototype ```c -size_t t8_cmesh_trees_size (t8_cmesh_trees_t trees); +t8_forest_t t8_forest_new_uniform (t8_cmesh_t cmesh, const t8_scheme_c *scheme, const int level, const int do_face_ghost, sc_MPI_Comm comm); ``` """ -function t8_cmesh_trees_size(trees) - @ccall libt8.t8_cmesh_trees_size(trees::t8_cmesh_trees_t)::Csize_t +function t8_forest_new_uniform(cmesh, scheme, level, do_face_ghost, comm) + @ccall libt8.t8_forest_new_uniform(cmesh::t8_cmesh_t, scheme::Ptr{t8_scheme_c}, level::Cint, do_face_ghost::Cint, comm::Cint)::t8_forest_t end """ - t8_cmesh_trees_init_attributes(trees, ltree_id, num_attributes, attr_bytes) - -For one tree in a trees structure set the number of attributes and temporarily store the total size of all of this tree's attributes. This temporary value is used in t8_cmesh_trees_finish_part. + t8_forest_new_adapt(forest_from, adapt_fn, recursive, do_face_ghost, user_data) -# Arguments -* `trees`:\\[in,out\\] The trees structure to be updated. -* `ltree_id`:\\[in\\] The local id of one tree in *trees*. -* `num_attributes`:\\[in\\] The number of attributes of this tree. -* `attr_bytes`:\\[in\\] The total number of bytes of all attributes of this tree. -### Prototype -```c -void t8_cmesh_trees_init_attributes (t8_cmesh_trees_t trees, t8_locidx_t ltree_id, size_t num_attributes, size_t attr_bytes); -``` -""" -function t8_cmesh_trees_init_attributes(trees, ltree_id, num_attributes, attr_bytes) - @ccall libt8.t8_cmesh_trees_init_attributes(trees::t8_cmesh_trees_t, ltree_id::t8_locidx_t, num_attributes::Csize_t, attr_bytes::Csize_t)::Cvoid -end +Build a adapted forest from another forest. -""" - t8_cmesh_trees_get_attribute(trees, ltree_id, package_id, key, size, is_ghost) +!!! note -Return an attribute that is stored at a tree. + This is equivalent to calling t8_forest_init, t8_forest_set_adapt, t8_forest_set_ghost, and t8_forest_commit # Arguments -* `trees`:\\[in\\] The trees structure. -* `ltree_id`:\\[in\\] The local id of the tree whose attribute is querid. -* `package_id`:\\[in\\] The package identifier of the attribute. -* `key`:\\[in\\] The key of the attribute within all attributes of the same package identifier. -* `size`:\\[out\\] If not NULL, the size (in bytes) of the attribute will be stored here. -* `is_ghost`:\\[in\\] If true, then *ltree_id* is interpreted as the local\\_id of a ghost. +* `forest_from`:\\[in\\] The forest to refine +* `adapt_fn`:\\[in\\] Adapt function to use +* `recursive`:\\[in\\] If true adaptation is recursive +* `do_face_ghost`:\\[in\\] If true, a layer of ghost elements is created for the forest. +* `user_data`:\\[in\\] If not NULL, the user data pointer of the forest is set to this value. # Returns -A pointer to the queried attribute, NULL if the attribute does not exist. +A new forest that is adapted from *forest_from*. ### Prototype ```c -void * t8_cmesh_trees_get_attribute (const t8_cmesh_trees_t trees, const t8_locidx_t ltree_id, const int package_id, const int key, size_t *size, int is_ghost); +t8_forest_t t8_forest_new_adapt (t8_forest_t forest_from, t8_forest_adapt_t adapt_fn, int recursive, int do_face_ghost, void *user_data); ``` """ -function t8_cmesh_trees_get_attribute(trees, ltree_id, package_id, key, size, is_ghost) - @ccall libt8.t8_cmesh_trees_get_attribute(trees::t8_cmesh_trees_t, ltree_id::t8_locidx_t, package_id::Cint, key::Cint, size::Ptr{Csize_t}, is_ghost::Cint)::Ptr{Cvoid} +function t8_forest_new_adapt(forest_from, adapt_fn, recursive, do_face_ghost, user_data) + @ccall libt8.t8_forest_new_adapt(forest_from::t8_forest_t, adapt_fn::t8_forest_adapt_t, recursive::Cint, do_face_ghost::Cint, user_data::Ptr{Cvoid})::t8_forest_t end """ - t8_cmesh_trees_attribute_size(tree) + t8_forest_ref(forest) -Return the total size of all attributes stored at a specified tree. +Increase the reference counter of a forest. # Arguments -* `tree`:\\[in\\] A tree structure. -# Returns -The total size (in bytes) of the attributes of *tree*. +* `forest`:\\[in,out\\] On input, this forest must exist with positive reference count. It may be in any state. ### Prototype ```c -size_t t8_cmesh_trees_attribute_size (t8_ctree_t tree); +void t8_forest_ref (t8_forest_t forest); ``` """ -function t8_cmesh_trees_attribute_size(tree) - @ccall libt8.t8_cmesh_trees_attribute_size(tree::t8_ctree_t)::Csize_t +function t8_forest_ref(forest) + @ccall libt8.t8_forest_ref(forest::t8_forest_t)::Cvoid end """ - t8_cmesh_trees_ghost_attribute_size(ghost) + t8_forest_unref(pforest) -Return the total size of all attributes stored at a specified ghost. +Decrease the reference counter of a forest. If the counter reaches zero, this forest is destroyed. In this case, the forest dereferences its cmesh and scheme members. # Arguments -* `ghost`:\\[in\\] A ghost structure. -# Returns -The total size (in bytes) of the attributes of *ghost*. +* `pforest`:\\[in,out\\] On input, the forest pointed to must exist with positive reference count. It may be in any state. If the reference count reaches zero, the forest is destroyed and this pointer set to NULL. Otherwise, the pointer is not changed and the forest is not modified in other ways. ### Prototype ```c -size_t t8_cmesh_trees_ghost_attribute_size (t8_cghost_t ghost); +void t8_forest_unref (t8_forest_t *pforest); ``` """ -function t8_cmesh_trees_ghost_attribute_size(ghost) - @ccall libt8.t8_cmesh_trees_ghost_attribute_size(ghost::t8_cghost_t)::Csize_t +function t8_forest_unref(pforest) + @ccall libt8.t8_forest_unref(pforest::Ptr{t8_forest_t})::Cvoid end """ - t8_cmesh_trees_add_attribute(trees, proc, attr, tree_id, index) + t8_forest_get_dimension(forest) ### Prototype ```c -void t8_cmesh_trees_add_attribute (const t8_cmesh_trees_t trees, int proc, const t8_stash_attribute_struct_t *attr, t8_locidx_t tree_id, size_t index); +int t8_forest_get_dimension (const t8_forest_t forest); ``` """ -function t8_cmesh_trees_add_attribute(trees, proc, attr, tree_id, index) - @ccall libt8.t8_cmesh_trees_add_attribute(trees::t8_cmesh_trees_t, proc::Cint, attr::Ptr{t8_stash_attribute_struct_t}, tree_id::t8_locidx_t, index::Csize_t)::Cvoid +function t8_forest_get_dimension(forest) + @ccall libt8.t8_forest_get_dimension(forest::Cint)::Cint end """ - t8_cmesh_trees_add_ghost_attribute(trees, attr, local_ghost_id, ghosts_inserted, index) - -Add the next ghost attribute from stash to the correct position in the char pointer structure Since it is created from stash, all attributes are added to part 0. The following attribute offset gets updated already. + t8_forest_element_coordinate(forest, ltree_id, element, corner_number, coordinates) -# Arguments -* `trees`:\\[in,out\\] The trees structure, whose char array is updated. -* `attr`:\\[in\\] The stash attribute that is added. -* `local_ghost_id`:\\[in\\] The local ghost id. -* `ghosts_inserted`:\\[in\\] The number of ghost that were already inserted, so that we do not write over the end. -* `index`:\\[in\\] The attribute index of the attribute to be added. ### Prototype ```c -void t8_cmesh_trees_add_ghost_attribute (const t8_cmesh_trees_t trees, const t8_stash_attribute_struct_t *attr, t8_locidx_t local_ghost_id, t8_locidx_t ghosts_inserted, size_t index); +void t8_forest_element_coordinate (t8_forest_t forest, t8_locidx_t ltree_id, const t8_element_t *element, int corner_number, double *coordinates); ``` """ -function t8_cmesh_trees_add_ghost_attribute(trees, attr, local_ghost_id, ghosts_inserted, index) - @ccall libt8.t8_cmesh_trees_add_ghost_attribute(trees::t8_cmesh_trees_t, attr::Ptr{t8_stash_attribute_struct_t}, local_ghost_id::t8_locidx_t, ghosts_inserted::t8_locidx_t, index::Csize_t)::Cvoid +function t8_forest_element_coordinate(forest, ltree_id, element, corner_number, coordinates) + @ccall libt8.t8_forest_element_coordinate(forest::Cint, ltree_id::t8_locidx_t, element::Ptr{t8_element_t}, corner_number::Cint, coordinates::Ptr{Cdouble})::Cvoid end """ - t8_cmesh_trees_get_numproc(trees) - -Return the number of parts of a trees structure. + t8_forest_element_from_ref_coords_ext(forest, ltreeid, element, ref_coords, num_coords, coords_out, stretch_factors) -# Arguments -* `trees`:\\[in\\] The trees structure. -# Returns -The number of parts in *trees*. ### Prototype ```c -size_t t8_cmesh_trees_get_numproc (const t8_cmesh_trees_t trees); +void t8_forest_element_from_ref_coords_ext (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *ref_coords, const size_t num_coords, double *coords_out, const double *stretch_factors); ``` """ -function t8_cmesh_trees_get_numproc(trees) - @ccall libt8.t8_cmesh_trees_get_numproc(trees::t8_cmesh_trees_t)::Csize_t +function t8_forest_element_from_ref_coords_ext(forest, ltreeid, element, ref_coords, num_coords, coords_out, stretch_factors) + @ccall libt8.t8_forest_element_from_ref_coords_ext(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, coords_out::Ptr{Cdouble}, stretch_factors::Ptr{Cdouble})::Cvoid end """ - t8_cmesh_tree_to_face_encode(dimension, face, orientation) - -Compute the tree-to-face information given a face and orientation value of a face connection. + t8_forest_element_from_ref_coords(forest, ltreeid, element, ref_coords, num_coords, coords_out) -# Arguments -* `dimension`:\\[in\\] The dimension of the corresponding eclasses. -* `face`:\\[in\\] A face number -* `orientation`:\\[in\\] A face-to-face orientation. -# Returns -The tree-to-face entry corresponding to the face/orientation combination. It is computed as t8\\_eclass\\_max\\_num\\_faces[dimension] * orientation + face ### Prototype ```c -int8_t t8_cmesh_tree_to_face_encode (const int dimension, const t8_locidx_t face, const int orientation); +void t8_forest_element_from_ref_coords (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *ref_coords, const size_t num_coords, double *coords_out); ``` """ -function t8_cmesh_tree_to_face_encode(dimension, face, orientation) - @ccall libt8.t8_cmesh_tree_to_face_encode(dimension::Cint, face::t8_locidx_t, orientation::Cint)::Int8 +function t8_forest_element_from_ref_coords(forest, ltreeid, element, ref_coords, num_coords, coords_out) + @ccall libt8.t8_forest_element_from_ref_coords(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, coords_out::Ptr{Cdouble})::Cvoid end """ - t8_cmesh_tree_to_face_decode(dimension, tree_to_face, face, orientation) - -Given a tree-to-face value, get its encoded face number and orientation. - -!!! note - - This function is the inverse operation of t8_cmesh_tree_to_face_encode If F = t8\\_eclass\\_max\\_num\\_faces[dimension], we get orientation = tree\\_to\\_face / F face = tree\\_to\\_face % F + t8_forest_element_centroid(forest, ltreeid, element, coordinates) -# Arguments -* `dimension`:\\[in\\] The dimension of the corresponding eclasses. -* `tree_to_face`:\\[in\\] A tree-to-face value -* `face`:\\[out\\] On output filled with the stored face value. -* `orientation`:\\[out\\] On output filled with the stored orientation value. ### Prototype ```c -void t8_cmesh_tree_to_face_decode (const int dimension, const int8_t tree_to_face, int *face, int *orientation); +void t8_forest_element_centroid (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, double *coordinates); ``` """ -function t8_cmesh_tree_to_face_decode(dimension, tree_to_face, face, orientation) - @ccall libt8.t8_cmesh_tree_to_face_decode(dimension::Cint, tree_to_face::Int8, face::Ptr{Cint}, orientation::Ptr{Cint})::Cvoid +function t8_forest_element_centroid(forest, ltreeid, element, coordinates) + @ccall libt8.t8_forest_element_centroid(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, coordinates::Ptr{Cdouble})::Cvoid end """ - t8_cmesh_trees_print(cmesh, trees) - -Print the trees,ghosts and their neighbors in ASCII format t stdout. This function is used for debugging purposes. + t8_forest_element_diam(forest, ltreeid, element) -# Arguments -* `cmesh`:\\[in\\] A coarse mesh structure that must be committed. -* `trees`:\\[in\\] The trees structure of *cmesh*. ### Prototype ```c -void t8_cmesh_trees_print (t8_cmesh_t cmesh, t8_cmesh_trees_t trees); +double t8_forest_element_diam (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element); ``` """ -function t8_cmesh_trees_print(cmesh, trees) - @ccall libt8.t8_cmesh_trees_print(cmesh::t8_cmesh_t, trees::t8_cmesh_trees_t)::Cvoid +function t8_forest_element_diam(forest, ltreeid, element) + @ccall libt8.t8_forest_element_diam(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t})::Cdouble end """ - t8_cmesh_trees_bcast(cmesh_in, root, comm) + t8_forest_element_volume(forest, ltreeid, element) ### Prototype ```c -void t8_cmesh_trees_bcast (t8_cmesh_t cmesh_in, int root, sc_MPI_Comm comm); +double t8_forest_element_volume (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element); ``` """ -function t8_cmesh_trees_bcast(cmesh_in, root, comm) - @ccall libt8.t8_cmesh_trees_bcast(cmesh_in::t8_cmesh_t, root::Cint, comm::MPI_Comm)::Cvoid +function t8_forest_element_volume(forest, ltreeid, element) + @ccall libt8.t8_forest_element_volume(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t})::Cdouble end """ - t8_cmesh_trees_is_face_consistent(cmesh, trees) - -Check whether the face connection of a trees structure are consistent. That is if tree1 lists tree2 as neighbor at face i with ttf entries (or,face j), then tree2 must list tree1 as neighbor at face j with ttf entries (or, face i). + t8_forest_element_face_area(forest, ltreeid, element, face) -# Arguments -* `cmesh`:\\[in\\] A cmesh structure to be checked. -* `trees`:\\[in\\] The cmesh's trees struct. -# Returns -True if the face connections are consistent, False if not. ### Prototype ```c -int t8_cmesh_trees_is_face_consistent (t8_cmesh_t cmesh, t8_cmesh_trees_t trees); +double t8_forest_element_face_area (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, int face); ``` """ -function t8_cmesh_trees_is_face_consistent(cmesh, trees) - @ccall libt8.t8_cmesh_trees_is_face_consistent(cmesh::t8_cmesh_t, trees::t8_cmesh_trees_t)::Cint +function t8_forest_element_face_area(forest, ltreeid, element, face) + @ccall libt8.t8_forest_element_face_area(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, face::Cint)::Cdouble end """ - t8_cmesh_trees_is_equal(cmesh, trees_a, trees_b) + t8_forest_element_face_centroid(forest, ltreeid, element, face, centroid) ### Prototype ```c -int t8_cmesh_trees_is_equal (t8_cmesh_t cmesh, t8_cmesh_trees_t trees_a, t8_cmesh_trees_t trees_b); +void t8_forest_element_face_centroid (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, int face, double centroid[3]); ``` """ -function t8_cmesh_trees_is_equal(cmesh, trees_a, trees_b) - @ccall libt8.t8_cmesh_trees_is_equal(cmesh::t8_cmesh_t, trees_a::t8_cmesh_trees_t, trees_b::t8_cmesh_trees_t)::Cint +function t8_forest_element_face_centroid(forest, ltreeid, element, face, centroid) + @ccall libt8.t8_forest_element_face_centroid(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, face::Cint, centroid::Ptr{Cdouble})::Cvoid end """ - t8_cmesh_trees_destroy(trees) - -Free all memory allocated with a trees structure. This means that all coarse trees and ghosts, their face neighbor entries and attributes and the additional structures of trees are freed. + t8_forest_element_face_normal(forest, ltreeid, element, face, normal) -# Arguments -* `trees`:\\[in,out\\] The tree structure to be destroyed. Set to NULL on output. ### Prototype ```c -void t8_cmesh_trees_destroy (t8_cmesh_trees_t *trees); +void t8_forest_element_face_normal (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, int face, double normal[3]); ``` """ -function t8_cmesh_trees_destroy(trees) - @ccall libt8.t8_cmesh_trees_destroy(trees::Ptr{t8_cmesh_trees_t})::Cvoid +function t8_forest_element_face_normal(forest, ltreeid, element, face, normal) + @ccall libt8.t8_forest_element_face_normal(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, face::Cint, normal::Ptr{Cdouble})::Cvoid end """ -This structure holds the connectivity data of the coarse mesh. It can either be replicated, then each process stores a copy of the whole mesh, or partitioned. In the latter case, each process only stores a local portion of the mesh plus information about ghost elements. - -The coarse mesh is a collection of coarse trees that can be identified along faces. TODO: this description is outdated. rewrite it. The array ctrees stores these coarse trees sorted by their (global) tree\\_id. If the mesh if partitioned it is partitioned according to an (possible only virtually existing) underlying fine mesh. Therefore the ctrees array can store duplicated trees on different processes, if each of these processes owns elements of the same tree in the fine mesh. - -Each tree stores information about its face-neighbours in an array of t8_ctree_fneighbor. + t8_forest_ghost -If partitioned the ghost trees are stored in a hash table that is backed up by an array. The hash value of a ghost tree is its tree\\_id modulo the number of ghosts on this process. +This struct stores various information about a forest's ghost elements and ghost trees. -# See also -t8\\_ctree\\_fneighbor +| Field | Note | +| :-------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| rc | The reference counter. | +| num\\_ghosts\\_elements | The count of non-local ghost leaf elements | +| num\\_remote\\_elements | The count of local leaf elements that are ghost to another process. | +| ghost\\_type | Describes which neighbors are considered ghosts. | +| ghost\\_trees | ghost tree data: global\\_id. eclass. elements. In linear id order | +| global\\_tree\\_to\\_ghost\\_tree | Indexes into ghost\\_trees. Given a global tree id I give the index i such that the tree is in ghost\\_trees[i] | +| process\\_offsets | Given a process, return the first ghost tree and within it the first element of that process. | +| remote\\_ghosts | array of local trees that have ghost elements for another process. for each tree an array of [`t8_element_t`](@ref) * of the local ghost elements. Also an array of [`t8_locidx_t`](@ref) of the local indices of these elements within the tree. It is a hash table, hashed with the rank of a remote process. Sorted within each process by linear id. | +| remote\\_processes | The ranks of the processes for which local elements are ghost. Array of int's. | +| glo\\_tree\\_mempool | The global tree memory pool. | +| proc\\_offset\\_mempool | The process offset memory pool. | """ -const t8_cmesh_struct_t = t8_cmesh - -const t8_cghost_struct_t = t8_cghost - -"""This structure holds the data of a local tree including the information about face neighbors. For those the tree\\_to\\_face index is computed as follows. Let F be the maximal number of faces of any eclass of the cmesh's dimension, then ttf % F is the face number and ttf / F is the orientation. (t8_eclass_max_num_faces) The orientation is determined as follows. Let my\\_face and other\\_face be the two face numbers of the connecting trees. We chose a main\\_face from them as follows: Either both trees have the same element class, then the face with the lower face number is the main\\_face or the trees belong to different classes in which case the face belonging to the tree with the lower class according to the ordering triangle < square, hex < tet < prism < pyramid, is the main\\_face. Then face corner 0 of the main\\_face connects to a face corner k in the other face. The face orientation is defined as the number k. If the classes are equal and my\\_face == other\\_face, treating either of both faces as the main\\_face leads to the same result. See https://arxiv.org/pdf/1611.02929.pdf for more details.""" -const t8_ctree_struct_t = t8_ctree - -const t8_cmesh_trees_struct_t = t8_cmesh_trees +struct t8_forest_ghost + rc::t8_refcount_t + num_ghosts_elements::t8_locidx_t + num_remote_elements::t8_locidx_t + ghost_type::t8_ghost_type_t + ghost_trees::Ptr{sc_array_t} + global_tree_to_ghost_tree::Ptr{sc_hash_t} + process_offsets::Ptr{sc_hash_t} + remote_ghosts::Ptr{sc_hash_array_t} + remote_processes::Ptr{sc_array_t} + glo_tree_mempool::Ptr{sc_mempool_t} + proc_offset_mempool::Ptr{sc_mempool_t} +end -const t8_part_tree_struct_t = t8_part_tree +const t8_forest_ghost_t = Ptr{t8_forest_ghost} """ -This struct is used to profile cmesh algorithms. The cmesh struct stores a pointer to a profile struct, and if it is nonzero, various runtimes and data measurements are stored here. + t8_forest_ghost_init(pghost, ghost_type) + +Initialize a ghost type of a forest. +# Arguments +* `pghost`:\\[out\\] Pointer to the forest's ghost. +* `ghost_type`:\\[in\\] The type of the ghost elements, # See also -[`t8_cmesh_set_profiling`](@ref) and, [`t8_cmesh_print_profile`](@ref) +[`t8_ghost_type_t`](@ref). + +### Prototype +```c +void t8_forest_ghost_init (t8_forest_ghost_t *pghost, t8_ghost_type_t ghost_type); +``` """ -const t8_cprofile_struct_t = t8_cprofile +function t8_forest_ghost_init(pghost, ghost_type) + @ccall libt8.t8_forest_ghost_init(pghost::Ptr{t8_forest_ghost_t}, ghost_type::t8_ghost_type_t)::Cvoid +end """ - t8_element_array_t + t8_forest_ghost_num_trees(forest) -The [`t8_element_array_t`](@ref) is an array to store [`t8_element_t`](@ref) * of a given eclass\\_scheme implementation. It is a wrapper around sc_array_t. Each time, a new element is created by the functions for t8_element_array_t, the eclass function either t8_element_new or t8_element_init is called for the element. Thus, each element in a t8_element_array_t is automatically initialized properly. +Return the number of trees in a ghost. -| Field | Note | -| :----- | :--------------------------------------------------- | -| scheme | An eclass scheme of which elements should be stored | -| array | The array in which the elements are stored | +# Arguments +* `forest`:\\[in\\] The forest. +# Returns +The number of trees in the forest's ghost (or 0 if ghost structure does not exist). +### Prototype +```c +t8_locidx_t t8_forest_ghost_num_trees (const t8_forest_t forest); +``` """ -struct t8_element_array_t - scheme::Ptr{t8_eclass_scheme_c} - array::sc_array_t +function t8_forest_ghost_num_trees(forest) + @ccall libt8.t8_forest_ghost_num_trees(forest::t8_forest_t)::t8_locidx_t end """ - t8_element_array_new(scheme) + t8_forest_ghost_get_tree_element_offset(forest, lghost_tree) -Creates a new array structure with 0 elements. +Return the element offset of a ghost tree. + +!!! note + + forest must be committed before calling this function. # Arguments -* `scheme`:\\[in\\] The eclass scheme of which elements should be stored. +* `forest`:\\[in\\] The forest with constructed ghost layer. +* `lghost_tree`:\\[in\\] A local ghost id of a ghost tree. # Returns -Return an allocated array of zero length. +The element offset of this ghost tree within the set of local ghost elements. ### Prototype ```c -t8_element_array_t * t8_element_array_new (t8_eclass_scheme_c *scheme); +t8_locidx_t t8_forest_ghost_get_tree_element_offset (t8_forest_t forest, t8_locidx_t lghost_tree); ``` """ -function t8_element_array_new(scheme) - @ccall libt8.t8_element_array_new(scheme::Ptr{t8_eclass_scheme_c})::Ptr{t8_element_array_t} +function t8_forest_ghost_get_tree_element_offset(forest, lghost_tree) + @ccall libt8.t8_forest_ghost_get_tree_element_offset(forest::t8_forest_t, lghost_tree::t8_locidx_t)::t8_locidx_t end """ - t8_element_array_new_count(scheme, num_elements) + t8_forest_ghost_tree_num_leaf_elements(forest, lghost_tree) -Creates a new array structure with a given length (number of elements) and calls t8_element_new for those elements. +Given an index in the ghost\\_tree array, return this tree's number of leaf elements # Arguments -* `scheme`:\\[in\\] The eclass scheme of which elements should be stored. -* `num_elements`:\\[in\\] Initial number of array elements. +* `forest`:\\[in\\] The *forest*. Ghost layer must exist. +* `lghost_tree`:\\[in\\] The ghost tree id of a ghost tree. # Returns -Return an allocated array with allocated and initialized elements for which t8_element_new was called. +The number of ghost leaf elements of the tree. *forest* must be committed before calling this function. ### Prototype ```c -t8_element_array_t * t8_element_array_new_count (t8_eclass_scheme_c *scheme, size_t num_elements); +t8_locidx_t t8_forest_ghost_tree_num_leaf_elements (t8_forest_t forest, t8_locidx_t lghost_tree); ``` """ -function t8_element_array_new_count(scheme, num_elements) - @ccall libt8.t8_element_array_new_count(scheme::Ptr{t8_eclass_scheme_c}, num_elements::Csize_t)::Ptr{t8_element_array_t} +function t8_forest_ghost_tree_num_leaf_elements(forest, lghost_tree) + @ccall libt8.t8_forest_ghost_tree_num_leaf_elements(forest::t8_forest_t, lghost_tree::t8_locidx_t)::t8_locidx_t end """ - t8_element_array_init(element_array, scheme) + t8_forest_ghost_get_tree_leaf_elements(forest, lghost_tree) -Initializes an already allocated (or static) array structure. +Get a pointer to the ghost leaf element array of a ghost tree. # Arguments -* `element_array`:\\[in,out\\] Array structure to be initialized. -* `scheme`:\\[in\\] The eclass scheme of which elements should be stored. +* `forest`:\\[in\\] The forest. Ghost layer must exist. +* `lghost_tree`:\\[in\\] The ghost tree id of a ghost tree. +# Returns +A pointer to the array of ghost leaf elements of the tree. *forest* must be committed before calling this function. ### Prototype ```c -void t8_element_array_init (t8_element_array_t *element_array, t8_eclass_scheme_c *scheme); +t8_element_array_t * t8_forest_ghost_get_tree_leaf_elements (const t8_forest_t forest, const t8_locidx_t lghost_tree); ``` """ -function t8_element_array_init(element_array, scheme) - @ccall libt8.t8_element_array_init(element_array::Ptr{t8_element_array_t}, scheme::Ptr{t8_eclass_scheme_c})::Cvoid +function t8_forest_ghost_get_tree_leaf_elements(forest, lghost_tree) + @ccall libt8.t8_forest_ghost_get_tree_leaf_elements(forest::t8_forest_t, lghost_tree::t8_locidx_t)::Ptr{t8_element_array_t} end """ - t8_element_array_init_size(element_array, scheme, num_elements) + t8_forest_ghost_get_ghost_treeid(forest, gtreeid) -Initializes an already allocated (or static) array structure and allocates a given number of elements and initializes them with t8_element_init. +Given a global tree compute the ghost local tree id of it. # Arguments -* `element_array`:\\[in,out\\] Array structure to be initialized. -* `scheme`:\\[in\\] The eclass scheme of which elements should be stored. -* `num_elements`:\\[in\\] Number of initial array elements. +* `forest`:\\[in\\] The forest. Ghost layer must exist. +* `gtreeid`:\\[in\\] A global tree in *forest*. +# Returns +If *gtreeid* is also a ghost tree, the index in the ghost->ghost\\_trees array of the tree. Otherwise a negative number. *forest* must be committed before calling this function. +# See also +https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. + ### Prototype ```c -void t8_element_array_init_size (t8_element_array_t *element_array, t8_eclass_scheme_c *scheme, size_t num_elements); +t8_locidx_t t8_forest_ghost_get_ghost_treeid (t8_forest_t forest, t8_gloidx_t gtreeid); ``` """ -function t8_element_array_init_size(element_array, scheme, num_elements) - @ccall libt8.t8_element_array_init_size(element_array::Ptr{t8_element_array_t}, scheme::Ptr{t8_eclass_scheme_c}, num_elements::Csize_t)::Cvoid +function t8_forest_ghost_get_ghost_treeid(forest, gtreeid) + @ccall libt8.t8_forest_ghost_get_ghost_treeid(forest::t8_forest_t, gtreeid::t8_gloidx_t)::t8_locidx_t end """ - t8_element_array_init_view(view, array, offset, length) + t8_forest_ghost_get_tree_class(forest, lghost_tree) -Initializes an already allocated (or static) view from existing t8\\_element\\_array. The array view returned does not require [`t8_element_array_reset`](@ref) (doesn't hurt though). +Given an index in the ghost\\_tree array, return this tree's element class. # Arguments -* `view`:\\[in,out\\] Array structure to be initialized. -* `array`:\\[in\\] The array must not be resized while view is alive. -* `offset`:\\[in\\] The offset of the viewed section in element units. This offset cannot be changed until the view is reset. -* `length`:\\[in\\] The length of the view in element units. The view cannot be resized to exceed this length. It is not necessary to call [`sc_array_reset`](@ref) later. +* `forest`:\\[in\\] A committed forest. +* `lghost_tree`:\\[in\\] The tree's local index in the ghost\\_tree array. +# Returns +The element class of the given tree. ### Prototype ```c -void t8_element_array_init_view (t8_element_array_t *view, t8_element_array_t *array, size_t offset, size_t length); +t8_eclass_t t8_forest_ghost_get_tree_class (const t8_forest_t forest, const t8_locidx_t lghost_tree); ``` """ -function t8_element_array_init_view(view, array, offset, length) - @ccall libt8.t8_element_array_init_view(view::Ptr{t8_element_array_t}, array::Ptr{t8_element_array_t}, offset::Csize_t, length::Csize_t)::Cvoid +function t8_forest_ghost_get_tree_class(forest, lghost_tree) + @ccall libt8.t8_forest_ghost_get_tree_class(forest::t8_forest_t, lghost_tree::t8_locidx_t)::t8_eclass_t end """ - t8_element_array_init_data(view, base, scheme, elem_count) + t8_forest_ghost_get_global_treeid(forest, lghost_tree) -Initializes an already allocated (or static) view from given plain C data (array of [`t8_element_t`](@ref)). The array view returned does not require [`t8_element_array_reset`](@ref) (doesn't hurt though). +Given a local ghost tree compute the global tree id of it. # Arguments -* `view`:\\[in,out\\] Array structure to be initialized. -* `base`:\\[in\\] The data must not be moved while view is alive. Must be an array of [`t8_element_t`](@ref) corresponding to *scheme*. -* `scheme`:\\[in\\] The eclass scheme of the elements stored in *base*. -* `elem_count`:\\[in\\] The length of the view in element units. The view cannot be resized to exceed this length. It is not necessary to call [`t8_element_array_reset`](@ref) later. +* `forest`:\\[in\\] The forest. Ghost layer must exist. +* `lghost_tree`:\\[in\\] The ghost tree id of a ghost tree. +# Returns +The global id of the local ghost tree *lghost_tree*. *forest* must be committed before calling this function. +# See also +https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. + ### Prototype ```c -void t8_element_array_init_data (t8_element_array_t *view, t8_element_t *base, t8_eclass_scheme_c *scheme, size_t elem_count); +t8_gloidx_t t8_forest_ghost_get_global_treeid (const t8_forest_t forest, const t8_locidx_t lghost_tree); ``` """ -function t8_element_array_init_data(view, base, scheme, elem_count) - @ccall libt8.t8_element_array_init_data(view::Ptr{t8_element_array_t}, base::Ptr{t8_element_t}, scheme::Ptr{t8_eclass_scheme_c}, elem_count::Csize_t)::Cvoid +function t8_forest_ghost_get_global_treeid(forest, lghost_tree) + @ccall libt8.t8_forest_ghost_get_global_treeid(forest::t8_forest_t, lghost_tree::t8_locidx_t)::t8_gloidx_t end """ - t8_element_array_init_copy(element_array, scheme, data, num_elements) + t8_forest_ghost_get_leaf_element(forest, lghost_tree, lelement) -Initializes an already allocated (or static) array structure and copy an existing array of [`t8_element_t`](@ref) into it. +Given an index into the ghost\\_trees array and for that tree an element index, return the corresponding element. # Arguments -* `element_array`:\\[in,out\\] Array structure to be initialized. -* `scheme`:\\[in\\] The eclass scheme of which elements should be stored. -* `data`:\\[in\\] An array of [`t8_element_t`](@ref) which will be copied into *element_array*. The elements in *data* must belong to *scheme* and must be properly initialized with either t8_element_new or t8_element_init. -* `num_elements`:\\[in\\] Number of elements in *data* to be copied. +* `forest`:\\[in\\] The *forest*. Ghost layer must exist. +* `lghost_tree`:\\[in\\] The ghost tree id of a ghost tree. +* `lelement`:\\[in\\] The local id of the ghost leaf element considered. +# Returns +A pointer to the ghost leaf element. *forest* must be committed before calling this function. ### Prototype ```c -void t8_element_array_init_copy (t8_element_array_t *element_array, t8_eclass_scheme_c *scheme, t8_element_t *data, size_t num_elements); +t8_element_t * t8_forest_ghost_get_leaf_element (t8_forest_t forest, t8_locidx_t lghost_tree, t8_locidx_t lelement); ``` """ -function t8_element_array_init_copy(element_array, scheme, data, num_elements) - @ccall libt8.t8_element_array_init_copy(element_array::Ptr{t8_element_array_t}, scheme::Ptr{t8_eclass_scheme_c}, data::Ptr{t8_element_t}, num_elements::Csize_t)::Cvoid +function t8_forest_ghost_get_leaf_element(forest, lghost_tree, lelement) + @ccall libt8.t8_forest_ghost_get_leaf_element(forest::t8_forest_t, lghost_tree::t8_locidx_t, lelement::t8_locidx_t)::Ptr{t8_element_t} end """ - t8_element_array_resize(element_array, new_count) - -Change the number of elements stored in an element array. - -!!! note + t8_forest_ghost_get_remotes(forest, num_remotes) - If *new_count* is larger than the number of current elements on *element_array*, then t8_element_init is called for the new elements. +Return the array of remote ranks. # Arguments -* `element_array`:\\[in,out\\] The element array to be modified. -* `new_count`:\\[in\\] The new element count of the array. If it is zero the effect equals t8_element_array_reset. +* `forest`:\\[in\\] A forest with constructed ghost layer. +* `num_remotes`:\\[in,out\\] On output the number of remote ranks is stored here. +# Returns +The array of remote ranks in ascending order. ### Prototype ```c -void t8_element_array_resize (t8_element_array_t *element_array, size_t new_count); +int * t8_forest_ghost_get_remotes (t8_forest_t forest, int *num_remotes); ``` """ -function t8_element_array_resize(element_array, new_count) - @ccall libt8.t8_element_array_resize(element_array::Ptr{t8_element_array_t}, new_count::Csize_t)::Cvoid +function t8_forest_ghost_get_remotes(forest, num_remotes) + @ccall libt8.t8_forest_ghost_get_remotes(forest::t8_forest_t, num_remotes::Ptr{Cint})::Ptr{Cint} end """ - t8_element_array_copy(dest, src) + t8_forest_ghost_remote_first_tree(forest, remote) -Copy the contents of an array into another. Both arrays must have the same eclass\\_scheme. +Return the first local ghost tree of a remote rank. # Arguments -* `dest`:\\[in\\] Array will be resized and get new data. -* `src`:\\[in\\] Array used as source of new data, will not be changed. +* `forest`:\\[in\\] A forest with constructed ghost layer. +* `remote`:\\[in\\] A remote rank of the ghost layer in *forest*. +# Returns +The ghost tree id of the first ghost tree that stores ghost elements of *remote*. ### Prototype ```c -void t8_element_array_copy (t8_element_array_t *dest, const t8_element_array_t *src); +t8_locidx_t t8_forest_ghost_remote_first_tree (t8_forest_t forest, int remote); ``` """ -function t8_element_array_copy(dest, src) - @ccall libt8.t8_element_array_copy(dest::Ptr{t8_element_array_t}, src::Ptr{t8_element_array_t})::Cvoid +function t8_forest_ghost_remote_first_tree(forest, remote) + @ccall libt8.t8_forest_ghost_remote_first_tree(forest::t8_forest_t, remote::Cint)::t8_locidx_t end """ - t8_element_array_push(element_array) + t8_forest_ghost_remote_first_elem(forest, remote) -Enlarge an array by one element. +Return the local index of the first ghost element that belongs to a given remote rank. # Arguments -* `element_array`:\\[in\\] Array structure to be modified. +* `forest`:\\[in\\] A forest with constructed ghost layer. +* `remote`:\\[in\\] A remote rank of the ghost layer in *forest*. # Returns -Returns a pointer to a newly added element for which t8_element_init was called. +The index i in the ghost elements of the first element of rank *remote* ### Prototype ```c -t8_element_t * t8_element_array_push (t8_element_array_t *element_array); +t8_locidx_t t8_forest_ghost_remote_first_elem (t8_forest_t forest, int remote); ``` """ -function t8_element_array_push(element_array) - @ccall libt8.t8_element_array_push(element_array::Ptr{t8_element_array_t})::Ptr{t8_element_t} +function t8_forest_ghost_remote_first_elem(forest, remote) + @ccall libt8.t8_forest_ghost_remote_first_elem(forest::t8_forest_t, remote::Cint)::t8_locidx_t end """ - t8_element_array_push_count(element_array, count) + t8_forest_ghost_ref(ghost) -Enlarge an array by a number of elements. +Increase the reference count of a ghost structure. # Arguments -* `element_array`:\\[in\\] Array structure to be modified. -* `count`:\\[in\\] The number of elements to add. -# Returns -Returns a pointer to the newly added elements for which t8_element_init was called. +* `ghost`:\\[in,out\\] On input, this ghost structure must exist with positive reference count. ### Prototype ```c -t8_element_t * t8_element_array_push_count (t8_element_array_t *element_array, size_t count); +void t8_forest_ghost_ref (t8_forest_ghost_t ghost); ``` """ -function t8_element_array_push_count(element_array, count) - @ccall libt8.t8_element_array_push_count(element_array::Ptr{t8_element_array_t}, count::Csize_t)::Ptr{t8_element_t} +function t8_forest_ghost_ref(ghost) + @ccall libt8.t8_forest_ghost_ref(ghost::t8_forest_ghost_t)::Cvoid end """ - t8_element_array_index_locidx(element_array, index) + t8_forest_ghost_unref(pghost) -Return a given element in an array. Const version. +Decrease the reference count of a ghost structure. If the counter reaches zero, the ghost structure is destroyed. See also t8_forest_ghost_destroy, which is to be preferred when it is known that the last reference to a cmesh is deleted. # Arguments -* `element_array`:\\[in\\] Array of elements. -* `index`:\\[in\\] The index of an element within the array. -# Returns -A pointer to the element stored at position *index* in *element_array*. +* `pghost`:\\[in,out\\] On input, the ghost structure pointed to must exist with positive reference count. If the reference count reaches zero, the ghost structure is destroyed and this pointer is set to NULL. Otherwise, the pointer is not changed. ### Prototype ```c -const t8_element_t * t8_element_array_index_locidx (const t8_element_array_t *element_array, t8_locidx_t index); +void t8_forest_ghost_unref (t8_forest_ghost_t *pghost); ``` """ -function t8_element_array_index_locidx(element_array, index) - @ccall libt8.t8_element_array_index_locidx(element_array::Ptr{t8_element_array_t}, index::t8_locidx_t)::Ptr{t8_element_t} +function t8_forest_ghost_unref(pghost) + @ccall libt8.t8_forest_ghost_unref(pghost::Ptr{t8_forest_ghost_t})::Cvoid end """ - t8_element_array_index_int(element_array, index) + t8_forest_ghost_destroy(pghost) -Return a given element in an array. Const version. +Verify that a ghost structure has only one reference left and destroy it. This function is preferred over t8_forest_ghost_unref when it is known that the last reference is to be deleted. # Arguments -* `element_array`:\\[in\\] Array of elements. -* `index`:\\[in\\] The index of an element within the array. -# Returns -A pointer to the element stored at position *index* in *element_array*. +* `pghost`:\\[in,out\\] This ghost structure must have a reference count of one. It can be in any state (committed or not). Then it effectively calls t8_forest_ghost_unref. ### Prototype ```c -const t8_element_t * t8_element_array_index_int (const t8_element_array_t *element_array, int index); +void t8_forest_ghost_destroy (t8_forest_ghost_t *pghost); ``` """ -function t8_element_array_index_int(element_array, index) - @ccall libt8.t8_element_array_index_int(element_array::Ptr{t8_element_array_t}, index::Cint)::Ptr{t8_element_t} +function t8_forest_ghost_destroy(pghost) + @ccall libt8.t8_forest_ghost_destroy(pghost::Ptr{t8_forest_ghost_t})::Cvoid end """ - t8_element_array_index_locidx_mutable(element_array, index) + t8_forest_ghost_create(forest) -Return a given element in an array. Mutable version. +Create one layer of ghost elements for a forest. # Arguments -* `element_array`:\\[in\\] Array of elements. -* `index`:\\[in\\] The index of an element within the array. -# Returns -A pointer to the element stored at position *index* in *element_array*. +* `forest`:\\[in,out\\] The forest. *forest* must be committed before calling this function. +# See also +[`t8_forest_set_ghost`](@ref) + ### Prototype ```c -t8_element_t * t8_element_array_index_locidx_mutable (t8_element_array_t *element_array, t8_locidx_t index); +void t8_forest_ghost_create (t8_forest_t forest); ``` """ -function t8_element_array_index_locidx_mutable(element_array, index) - @ccall libt8.t8_element_array_index_locidx_mutable(element_array::Ptr{t8_element_array_t}, index::t8_locidx_t)::Ptr{t8_element_t} +function t8_forest_ghost_create(forest) + @ccall libt8.t8_forest_ghost_create(forest::t8_forest_t)::Cvoid end """ - t8_element_array_index_int_mutable(element_array, index) + t8_forest_ghost_create_balanced_only(forest) -Return a given element in an array. Mutable version. +Create one layer of ghost elements for a forest. This version only works with balanced forests and is the original algorithm from p4est: Scalable Algorithms For Parallel Adaptive Mesh Refinement On Forests of Octrees + +!!! note + + The user should prefer t8_forest_ghost_create even for balanced forests. # Arguments -* `element_array`:\\[in\\] Array of elements. -* `index`:\\[in\\] The index of an element within the array. -# Returns -A pointer to the element stored at position *index* in *element_array*. +* `forest`:\\[in,out\\] The balanced forest/ *forest* must be committed before calling this function. ### Prototype ```c -t8_element_t * t8_element_array_index_int_mutable (t8_element_array_t *element_array, int index); +void t8_forest_ghost_create_balanced_only (t8_forest_t forest); ``` """ -function t8_element_array_index_int_mutable(element_array, index) - @ccall libt8.t8_element_array_index_int_mutable(element_array::Ptr{t8_element_array_t}, index::Cint)::Ptr{t8_element_t} +function t8_forest_ghost_create_balanced_only(forest) + @ccall libt8.t8_forest_ghost_create_balanced_only(forest::t8_forest_t)::Cvoid end """ - t8_element_array_get_scheme(element_array) + t8_forest_ghost_create_topdown(forest) -Return the eclass scheme associated to a t8\\_element\\_array. +Experimental version of t8_forest_ghost_create using the ghost\\_v3 algorithm -# Arguments -* `element_array`:\\[in\\] Array of elements. -# Returns -The eclass scheme stored at *element_array*. ### Prototype ```c -const t8_eclass_scheme_c * t8_element_array_get_scheme (const t8_element_array_t *element_array); +void t8_forest_ghost_create_topdown (t8_forest_t forest); ``` """ -function t8_element_array_get_scheme(element_array) - @ccall libt8.t8_element_array_get_scheme(element_array::Ptr{t8_element_array_t})::Ptr{t8_eclass_scheme_c} +function t8_forest_ghost_create_topdown(forest) + @ccall libt8.t8_forest_ghost_create_topdown(forest::t8_forest_t)::Cvoid end """ - t8_element_array_get_count(element_array) - -Return the number of elements stored in a [`t8_element_array_t`](@ref). + t8_forest_save(forest) -# Arguments -* `element_array`:\\[in\\] Array structure. -# Returns -The number of elements stored in *element_array*. ### Prototype ```c -size_t t8_element_array_get_count (const t8_element_array_t *element_array); +void t8_forest_save (t8_forest_t forest); ``` """ -function t8_element_array_get_count(element_array) - @ccall libt8.t8_element_array_get_count(element_array::Ptr{t8_element_array_t})::Csize_t +function t8_forest_save(forest) + @ccall libt8.t8_forest_save(forest::Cint)::Cvoid end """ - t8_element_array_get_size(element_array) - -Return the data size of elements stored in a [`t8_element_array_t`](@ref). + t8_forest_write_vtk_ext(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, write_ghosts, write_curved, do_not_use_API, num_data, data) -# Arguments -* `element_array`:\\[in\\] Array structure. -# Returns -The size (in bytes) of a single element in *element_array*. ### Prototype ```c -size_t t8_element_array_get_size (const t8_element_array_t *element_array); +int t8_forest_write_vtk_ext (t8_forest_t forest, const char *fileprefix, const int write_treeid, const int write_mpirank, const int write_level, const int write_element_id, const int write_ghosts, const int write_curved, int do_not_use_API, const int num_data, t8_vtk_data_field_t *data); ``` """ -function t8_element_array_get_size(element_array) - @ccall libt8.t8_element_array_get_size(element_array::Ptr{t8_element_array_t})::Csize_t +function t8_forest_write_vtk_ext(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, write_ghosts, write_curved, do_not_use_API, num_data, data) + @ccall libt8.t8_forest_write_vtk_ext(forest::Cint, fileprefix::Cstring, write_treeid::Cint, write_mpirank::Cint, write_level::Cint, write_element_id::Cint, write_ghosts::Cint, write_curved::Cint, do_not_use_API::Cint, num_data::Cint, data::Ptr{t8_vtk_data_field_t})::Cint end """ - t8_element_array_get_data(element_array) - -Return a const pointer to the real data array stored in a t8\\_element\\_array. + t8_forest_write_vtk(forest, fileprefix) -# Arguments -* `element_array`:\\[in\\] Array structure. -# Returns -A pointer to the stored data. If the number of stored elements is 0, then NULL is returned. ### Prototype ```c -const t8_element_t * t8_element_array_get_data (const t8_element_array_t *element_array); +int t8_forest_write_vtk (t8_forest_t forest, const char *fileprefix); ``` """ -function t8_element_array_get_data(element_array) - @ccall libt8.t8_element_array_get_data(element_array::Ptr{t8_element_array_t})::Ptr{t8_element_t} +function t8_forest_write_vtk(forest, fileprefix) + @ccall libt8.t8_forest_write_vtk(forest::Cint, fileprefix::Cstring)::Cint end +# typedef int ( * t8_forest_iterate_face_fn ) ( const t8_forest_t forest , const t8_locidx_t ltreeid , const t8_element_t * element , const int face , void * user_data , const t8_locidx_t tree_leaf_index ) """ - t8_element_array_get_data_mutable(element_array) - -Return a pointer to the real data array stored in a t8\\_element\\_array. +Callback function used in # Arguments -* `element_array`:\\[in\\] Array structure. +* `forest`:\\[in\\] The forest. +* `ltreeid`:\\[in\\] Local index of the tree containing the *element*. +* `element`:\\[in\\] The considered element. +* `face`:\\[in\\] The integer index of the considered face of *element*. +* `user_data`:\\[in\\] Some user-defined data, as void pointer. +* `tree_leaf_index`:\\[in\\] Tree-local index the first leaf. # Returns -A pointer to the stored data. If the number of stored elements is 0, then NULL is returned. -### Prototype -```c -t8_element_t * t8_element_array_get_data_mutable (t8_element_array_t *element_array); -``` +Nonzero if the element may touch the face and the top-down search shall be continued, zero otherwise. +# See also +[`t8_forest_iterate_faces`](@ref). """ -function t8_element_array_get_data_mutable(element_array) - @ccall libt8.t8_element_array_get_data_mutable(element_array::Ptr{t8_element_array_t})::Ptr{t8_element_t} -end +const t8_forest_iterate_face_fn = Ptr{Cvoid} +# typedef int ( * t8_forest_search_fn ) ( t8_forest_t forest , const t8_locidx_t ltreeid , const t8_element_t * element , const int is_leaf , const t8_element_array_t * leaf_elements , const t8_locidx_t tree_leaf_index ) """ - t8_element_array_get_array(element_array) +A call-back function used by t8_forest_search describing a search-criterion. Is called on an element and the search criterion should be checked on that element. Return true if the search criterion is met, false otherwise. -Return a const pointer to the [`sc_array`](@ref) stored in a t8\\_element\\_array. +# Arguments +* `forest`:\\[in\\] the forest +* `ltreeid`:\\[in\\] the local tree id of the current tree +* `element`:\\[in\\] the element for which the search criterion is checked. +* `is_leaf`:\\[in\\] true if and only if *element* is a leaf element +* `leaf_elements`:\\[in\\] the leaf elements in *forest* that are descendants of *element* (or the element itself if *is_leaf* is true) +* `tree_leaf_index`:\\[in\\] the local index of the first leaf in *leaf_elements* +# Returns +non-zero if the search criterion is met, zero otherwise. +""" +const t8_forest_search_fn = Ptr{Cvoid} -!!! note +# typedef void ( * t8_forest_query_fn ) ( t8_forest_t forest , const t8_locidx_t ltreeid , const t8_element_t * element , const int is_leaf , const t8_element_array_t * leaf_elements , const t8_locidx_t tree_leaf_index , sc_array_t * queries , sc_array_t * query_indices , int * query_matches , const size_t num_active_queries ) +""" +A call-back function used by t8_forest_search for queries. Is called on an element and all queries are checked on that element. All positive queries are passed further down to the children of the element up to leaf elements of the tree. The results of the check are stored in *query_matches*. - The data cannot be modified. +# Arguments +* `forest`:\\[in\\] the forest +* `ltreeid`:\\[in\\] the local tree id of the current tree +* `element`:\\[in\\] the element for which the queries are executed +* `is_leaf`:\\[in\\] true if and only if *element* is a leaf element +* `leaf_elements`:\\[in\\] the leaf elements in *forest* that are descendants of *element* (or the element itself if *is_leaf* is true) +* `tree_leaf_index`:\\[in\\] the local index of the first leaf in *leaf_elements* +* `queries`:\\[in\\] An array of queries that are checked by the function +* `query_indices`:\\[in\\] An array of size\\_t entries, where each entry is an index of a query in *queries*. +* `query_matches`:\\[in,out\\] An array of length *num_active_queries*. If the element is not a leave must be set to true or false at the i-th index for each query, specifying whether the element 'matches' the query of the i-th query index or not. When the element is a leaf we can return before all entries are set. +* `num_active_queries`:\\[in\\] The number of currently active queries (equals the number of entries of *query_matches* and entries of *query_indices*). +""" +const t8_forest_query_fn = Ptr{Cvoid} + +# typedef int ( * t8_forest_partition_search_fn ) ( const t8_forest_t forest , const t8_locidx_t ltreeid , const t8_element_t * element , const int pfirst , const int plast ) +""" +A call-back function used by t8_forest_search_partition describing a search-criterion. Is called on an element and the search criterion should be checked on that element. Return true if the search criterion is met, false otherwise. # Arguments -* `element_array`:\\[in\\] Array structure. +* `forest`:\\[in\\] the forest +* `ltreeid`:\\[in\\] the local tree id of the current tree in the cmesh. Since the cmesh has to be replicated, it coincides with the global tree id. +* `element`:\\[in\\] the element for which the search criterion is checked +* `pfirst`:\\[in\\] the first processor that owns part of *element*. Guaranteed to be non-empty. +* `plast`:\\[in\\] the last processor that owns part of *element*. Guaranteed to be non-empty. # Returns -A const pointer to the [`sc_array`](@ref) storing the data. -### Prototype -```c -const sc_array_t * t8_element_array_get_array (const t8_element_array_t *element_array); -``` +non-zero if the search criterion is met, zero otherwise. """ -function t8_element_array_get_array(element_array) - @ccall libt8.t8_element_array_get_array(element_array::Ptr{t8_element_array_t})::Ptr{sc_array_t} -end +const t8_forest_partition_search_fn = Ptr{Cvoid} +# typedef void ( * t8_forest_partition_query_fn ) ( const t8_forest_t forest , const t8_locidx_t ltreeid , const t8_element_t * element , const int pfirst , const int plast , void * queries , sc_array_t * query_indices , int * query_matches , const size_t num_active_queries ) """ - t8_element_array_get_array_mutable(element_array) +A call-back function used by t8_forest_search_partition for queries. Is called on an element and all queries are checked on that element. All positive queries are passed further down to the children of the element. The results of the check are stored in *query_matches*. -Return a mutable pointer to the [`sc_array`](@ref) stored in a t8\\_element\\_array. +# Arguments +* `forest`:\\[in\\] the forest +* `ltreeid`:\\[in\\] the local tree id of the current tree in the cmesh. Since the cmesh has to be replicated, it coincides with the global tree id. +* `element`:\\[in\\] the element for which the query is executed +* `pfirst`:\\[in\\] the first processor that owns part of *element*. Guaranteed to be non-empty. +* `plast`:\\[in\\] the last processor that owns part of *element*. Guaranteed to be non-empty. if this is equal to *pfirst*, then the recursion will stop for *element*'s branch after this function returns. +* `queries`:\\[in\\] an array of queries that are checked by the function +* `query_indices`:\\[in\\] an array of size\\_t entries, where each entry is an index of a query in *queries*. +* `query_matches`:\\[in,out\\] an array of length *num_active_queries*. If the element is not a leaf must be set to true or false at the i-th index for each query, specifying whether the element 'matches' the query of the i-th query index or not. When the element is a leaf we can return before all entries are set. +* `num_active_queries`:\\[in\\] The number of currently active queries (equals the number of entries of *query_matches* and entries of *query_indices*). +""" +const t8_forest_partition_query_fn = Ptr{Cvoid} -!!! note +""" + t8_forest_split_array(element, leaf_elements, offsets) - The data can be modified. +Split an array of elements according to the children of a given element E. In other words for each child C of E, find the index i, j, such that all descendants of C are elements[i], ..., elements[j-1]. # Arguments -* `element_array`:\\[in\\] Array structure. -# Returns -A pointer to the [`sc_array`](@ref) storing the data. +* `element`:\\[in\\] An element. +* `leaf_elements`:\\[in\\] An array of leaf elements of *element*. Thus, all elements must be descendants. Sorted by linear index. +* `offsets`:\\[in,out\\] On input an allocated array of *num_children_of_E* + 1 entries. On output entry i indicates the position in *leaf_elements* where the descandents of the i-th child of E start. ### Prototype ```c -sc_array_t * t8_element_array_get_array_mutable (t8_element_array_t *element_array); +void t8_forest_split_array (const t8_element_t *element, const t8_element_array_t *leaf_elements, size_t *offsets); ``` """ -function t8_element_array_get_array_mutable(element_array) - @ccall libt8.t8_element_array_get_array_mutable(element_array::Ptr{t8_element_array_t})::Ptr{sc_array_t} +function t8_forest_split_array(element, leaf_elements, offsets) + @ccall libt8.t8_forest_split_array(element::Ptr{t8_element_t}, leaf_elements::Ptr{t8_element_array_t}, offsets::Ptr{Csize_t})::Cvoid end """ - t8_element_array_reset(element_array) - -Sets the array count to zero and frees all elements. - -!!! note + t8_forest_iterate_faces(forest, ltreeid, element, face, leaf_elements, user_data, tree_lindex_of_first_leaf, callback) - Calling [`t8_element_array_init`](@ref), then any array operations, then [`t8_element_array_reset`](@ref) is memory neutral. +Iterate over all leaves of an element that touch a given face of the element. Callback is called in each recursive step with element as input. leaf\\_index is only not negative if element is a leaf, in which case it indicates the index of the leaf in the leaves of the tree. If it is negative, it is - (index + 1) Top-down iteration and callback is called on each intermediate level. If it returns false, the current element is not traversed further # Arguments -* `element_array`:\\[in,out\\] Array structure to be reset. +* `forest`:\\[in\\] A committed forest. +* `ltreeid`:\\[in\\] Local index of the tree containing the *element*. +* `element`:\\[in\\] The considered element. +* `face`:\\[in\\] The integer index of the considered face of *element*. +* `leaf_elements`:\\[in\\] The array of leaf elements that are descendants of *element*. Sorted by linear index. +* `user_data`:\\[in\\] The user data passed to the *callback* function. +* `tree_lindex_of_first_leaf`:\\[in\\] Tree-local index of the first leaf. +* `callback`:\\[in\\] The callback function. ### Prototype ```c -void t8_element_array_reset (t8_element_array_t *element_array); +void t8_forest_iterate_faces (const t8_forest_t forest, const t8_locidx_t ltreeid, const t8_element_t *element, const int face, const t8_element_array_t *leaf_elements, void *user_data, const t8_locidx_t tree_lindex_of_first_leaf, const t8_forest_iterate_face_fn callback); ``` """ -function t8_element_array_reset(element_array) - @ccall libt8.t8_element_array_reset(element_array::Ptr{t8_element_array_t})::Cvoid +function t8_forest_iterate_faces(forest, ltreeid, element, face, leaf_elements, user_data, tree_lindex_of_first_leaf, callback) + @ccall libt8.t8_forest_iterate_faces(forest::t8_forest_t, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, face::Cint, leaf_elements::Ptr{t8_element_array_t}, user_data::Ptr{Cvoid}, tree_lindex_of_first_leaf::t8_locidx_t, callback::t8_forest_iterate_face_fn)::Cvoid end """ - t8_element_array_truncate(element_array) - -Sets the array count to zero, but does not free elements. - -!!! note + t8_forest_search(forest, search_fn, query_fn, queries) - This is intended to allow an t8\\_element\\_array to be used as a reusable buffer, where the "high water mark" of the buffer is preserved, so that O(log (max n)) reallocs occur over the life of the buffer. +Perform a top-down search of the forest, executing a callback on each intermediate element. The search will enter each tree at least once. If the callback returns false for an element, its descendants are not further searched. To pass user data to the search\\_fn function use t8_forest_set_user_data. # Arguments -* `element_array`:\\[in,out\\] Element array structure to be truncated. +* `forest`:\\[in\\] The forest. +* `search_fn`:\\[in\\] The callback function describing the search criterion. +* `query_fn`:\\[in\\] The query function. +* `queries`:\\[in\\] The array of queries. ### Prototype ```c -void t8_element_array_truncate (t8_element_array_t *element_array); +void t8_forest_search (t8_forest_t forest, t8_forest_search_fn search_fn, t8_forest_query_fn query_fn, sc_array_t *queries); ``` """ -function t8_element_array_truncate(element_array) - @ccall libt8.t8_element_array_truncate(element_array::Ptr{t8_element_array_t})::Cvoid +function t8_forest_search(forest, search_fn, query_fn, queries) + @ccall libt8.t8_forest_search(forest::t8_forest_t, search_fn::t8_forest_search_fn, query_fn::t8_forest_query_fn, queries::Ptr{sc_array_t})::Cvoid end """ - t8_shmem_init(comm) + t8_forest_iterate_replace(forest_new, forest_old, replace_fn) + +Given two forest where the elements in one forest are either direct children or parents of the elements in the other forest compare the two forests and for each refined element or coarsened family in the old one, call a callback function providing the local indices of the old and new elements. + +!!! note + + To pass a user pointer to *replace_fn* use t8_forest_set_user_data and t8_forest_get_user_data. +# Arguments +* `forest_new`:\\[in\\] A forest, each element is a parent or child of an element in *forest_old*. +* `forest_old`:\\[in\\] The initial forest. +* `replace_fn`:\\[in\\] A replace callback function. ### Prototype ```c -void t8_shmem_init (sc_MPI_Comm comm); +void t8_forest_iterate_replace (t8_forest_t forest_new, t8_forest_t forest_old, t8_forest_replace_t replace_fn); ``` """ -function t8_shmem_init(comm) - @ccall libt8.t8_shmem_init(comm::MPI_Comm)::Cvoid +function t8_forest_iterate_replace(forest_new, forest_old, replace_fn) + @ccall libt8.t8_forest_iterate_replace(forest_new::t8_forest_t, forest_old::t8_forest_t, replace_fn::t8_forest_replace_t)::Cvoid end """ - t8_shmem_finalize(comm) + t8_forest_search_partition(forest, search_fn, query_fn, queries) + +Perform a top-down search of the global partition, executing a callback on each intermediate element. The search will enter each tree at least once. The recursion will only go down branches that are split between multiple processors. This is not a collective function. It does not communicate. The function expects the coarse mesh to be replicated. If the callback returns false for an element, its descendants are not further searched. To pass user data to **search_fn** function use t8_forest_set_user_data +# Arguments +* `forest`:\\[in\\] the forest to be searched +* `search_fn`:\\[in\\] a search callback function called on elements +* `query_fn`:\\[in\\] a query callback function called for all active queries of an element +* `queries`:\\[in,out\\] an array of queries that are checked by the function ### Prototype ```c -void t8_shmem_finalize (sc_MPI_Comm comm); +void t8_forest_search_partition (const t8_forest_t forest, t8_forest_partition_search_fn search_fn, t8_forest_partition_query_fn query_fn, sc_array_t *queries); ``` """ -function t8_shmem_finalize(comm) - @ccall libt8.t8_shmem_finalize(comm::MPI_Comm)::Cvoid +function t8_forest_search_partition(forest, search_fn, query_fn, queries) + @ccall libt8.t8_forest_search_partition(forest::t8_forest_t, search_fn::t8_forest_partition_search_fn, query_fn::t8_forest_partition_query_fn, queries::Ptr{sc_array_t})::Cvoid end """ - t8_shmem_set_type(comm, type) + t8_forest_partition(forest) + +Populate a forest with the partitioned elements of forest->set\\_from. Currently the elements are distributed evenly (each element has the same weight). +# Arguments +* `forest`:\\[in,out\\] The forest. ### Prototype ```c -void t8_shmem_set_type (sc_MPI_Comm comm, sc_shmem_type_t type); +void t8_forest_partition (t8_forest_t forest); ``` """ -function t8_shmem_set_type(comm, type) - @ccall libt8.t8_shmem_set_type(comm::MPI_Comm, type::sc_shmem_type_t)::Cvoid +function t8_forest_partition(forest) + @ccall libt8.t8_forest_partition(forest::t8_forest_t)::Cvoid end """ - t8_shmem_array_init(parray, elem_size, elem_count, comm) + t8_forest_partition_create_offsets(forest) + +Create the element\\_offset array of a partitioned forest. +# Arguments +* `forest`:\\[in,out\\] The forest. *forest* must be committed before calling this function. ### Prototype ```c -void t8_shmem_array_init (t8_shmem_array_t *parray, size_t elem_size, size_t elem_count, sc_MPI_Comm comm); +void t8_forest_partition_create_offsets (t8_forest_t forest); ``` """ -function t8_shmem_array_init(parray, elem_size, elem_count, comm) - @ccall libt8.t8_shmem_array_init(parray::Ptr{t8_shmem_array_t}, elem_size::Csize_t, elem_count::Csize_t, comm::MPI_Comm)::Cvoid +function t8_forest_partition_create_offsets(forest) + @ccall libt8.t8_forest_partition_create_offsets(forest::t8_forest_t)::Cvoid end """ - t8_shmem_array_start_writing(array) - -Enable writing mode for a shmem array. Only some processes may be allowed to write into the array, which is indicated by the return value being non-zero. - -!!! note + t8_forest_partition_next_nonempty_rank(forest, rank) - This function is MPI collective. +If t8_forest_partition_create_offsets was already called, compute for a given rank the next greater rank that is not empty. # Arguments -* `array`:\\[in,out\\] Initialized array. Writing will be enabled on certain processes. +* `forest`:\\[in\\] The forest. +* `rank`:\\[in\\] An MPI rank. # Returns -True if the calling process can write into the array. +A rank q > *rank* such that the forest has elements on *q*. If such a *q* does not exist, returns mpisize. ### Prototype ```c -int t8_shmem_array_start_writing (t8_shmem_array_t array); +int t8_forest_partition_next_nonempty_rank (t8_forest_t forest, int rank); ``` """ -function t8_shmem_array_start_writing(array) - @ccall libt8.t8_shmem_array_start_writing(array::t8_shmem_array_t)::Cint +function t8_forest_partition_next_nonempty_rank(forest, rank) + @ccall libt8.t8_forest_partition_next_nonempty_rank(forest::t8_forest_t, rank::Cint)::Cint end """ - t8_shmem_array_end_writing(array) - -Disable writing mode for a shmem array. - -!!! note + t8_forest_partition_create_first_desc(forest) - This function is MPI collective. +Create the array of global\\_first\\_descendant ids of a partitioned forest. # Arguments -* `array`:\\[in,out\\] Initialized with writing mode enabled. -# See also -[`t8_shmem_array_start_writing`](@ref). - +* `forest`:\\[in,out\\] The forest. *forest* must be committed before calling this function. ### Prototype ```c -void t8_shmem_array_end_writing (t8_shmem_array_t array); +void t8_forest_partition_create_first_desc (t8_forest_t forest); ``` """ -function t8_shmem_array_end_writing(array) - @ccall libt8.t8_shmem_array_end_writing(array::t8_shmem_array_t)::Cvoid +function t8_forest_partition_create_first_desc(forest) + @ccall libt8.t8_forest_partition_create_first_desc(forest::t8_forest_t)::Cvoid end """ - t8_shmem_array_set_gloidx(array, index, value) + t8_forest_partition_create_tree_offsets(forest) -Set an entry of a t8\\_shmem array that is used to store [`t8_gloidx_t`](@ref). The array must have writing mode enabled t8_shmem_array_start_writing. +Create the array tree offsets of a partitioned forest. This arrays stores at position p the global id of the first tree of this process. Or if this tree is shared, it stores -(global\\_id) - 1. # Arguments -* `array`:\\[in,out\\] The array to be modified. -* `index`:\\[in\\] The array entry to be modified. -* `value`:\\[in\\] The new value to be set. +* `forest`:\\[in,out\\] The forest. *forest* must be committed before calling this function. ### Prototype ```c -void t8_shmem_array_set_gloidx (t8_shmem_array_t array, int index, t8_gloidx_t value); +void t8_forest_partition_create_tree_offsets (t8_forest_t forest); ``` """ -function t8_shmem_array_set_gloidx(array, index, value) - @ccall libt8.t8_shmem_array_set_gloidx(array::t8_shmem_array_t, index::Cint, value::t8_gloidx_t)::Cvoid +function t8_forest_partition_create_tree_offsets(forest) + @ccall libt8.t8_forest_partition_create_tree_offsets(forest::t8_forest_t)::Cvoid end """ - t8_shmem_array_copy(dest, source) - -Copy the contents of one t8\\_shmem array into another. - -!!! note + t8_forest_partition_data(forest_from, forest_to, data_in, data_out) - *dest* must be initialized and match in element size and element count to *source*. +Re-Partition an array accordingly to a partitioned forest. !!! note - *dest* must have writing mode disabled. + *data_in* has to be of size equal to the number of local elements of *forest_from* *data_out* has to be already allocated and has to be of size equal to the number of local elements of *forest_to*. # Arguments -* `dest`:\\[in,out\\] The array in which *source* should be copied. -* `source`:\\[in\\] The array to copy. +* `forest_from`:\\[in\\] The forest before the partitioning step. +* `forest_to`:\\[in\\] The partitioned forest of *forest_from*. +* `data_in`:\\[in\\] A pointer to an [`sc_array_t`](@ref) holding data (one value per element) accordingly to *forest_from*. +* `data_out`:\\[in,out\\] A pointer to an already allocated [`sc_array_t`](@ref) capable of holding data accordingly to *forest_to*. ### Prototype ```c -void t8_shmem_array_copy (t8_shmem_array_t dest, t8_shmem_array_t source); +void t8_forest_partition_data (t8_forest_t forest_from, t8_forest_t forest_to, const sc_array_t *data_in, sc_array_t *data_out); ``` """ -function t8_shmem_array_copy(dest, source) - @ccall libt8.t8_shmem_array_copy(dest::t8_shmem_array_t, source::t8_shmem_array_t)::Cvoid +function t8_forest_partition_data(forest_from, forest_to, data_in, data_out) + @ccall libt8.t8_forest_partition_data(forest_from::t8_forest_t, forest_to::t8_forest_t, data_in::Ptr{sc_array_t}, data_out::Ptr{sc_array_t})::Cvoid end """ - t8_shmem_array_allgather(sendbuf, sendcount, sendtype, recvarray, recvcount, recvtype) + t8_forest_partition_test_boundary_element(forest) +Test if the last descendant of the last element of current rank has a smaller linear id than the stored first descendant of rank+1. If this is not the case, elements overlap. + +!!! note + + *forest* must be committed before calling this function. + +# Arguments +* `forest`:\\[in\\] The forest. ### Prototype ```c -void t8_shmem_array_allgather (const void *sendbuf, int sendcount, sc_MPI_Datatype sendtype, t8_shmem_array_t recvarray, int recvcount, sc_MPI_Datatype recvtype); +void t8_forest_partition_test_boundary_element (const t8_forest_t forest); ``` """ -function t8_shmem_array_allgather(sendbuf, sendcount, sendtype, recvarray, recvcount, recvtype) - @ccall libt8.t8_shmem_array_allgather(sendbuf::Ptr{Cvoid}, sendcount::Cint, sendtype::Cint, recvarray::t8_shmem_array_t, recvcount::Cint, recvtype::Cint)::Cvoid +function t8_forest_partition_test_boundary_element(forest) + @ccall libt8.t8_forest_partition_test_boundary_element(forest::t8_forest_t)::Cvoid end """ - t8_shmem_array_allgatherv(sendbuf, sendcount, sendtype, recvarray, recvtype, comm) + t8_forest_set_profiling(forest, set_profiling) ### Prototype ```c -void t8_shmem_array_allgatherv (void *sendbuf, const int sendcount, sc_MPI_Datatype sendtype, t8_shmem_array_t recvarray, sc_MPI_Datatype recvtype, sc_MPI_Comm comm); +void t8_forest_set_profiling (t8_forest_t forest, int set_profiling); ``` """ -function t8_shmem_array_allgatherv(sendbuf, sendcount, sendtype, recvarray, recvtype, comm) - @ccall libt8.t8_shmem_array_allgatherv(sendbuf::Ptr{Cvoid}, sendcount::Cint, sendtype::Cint, recvarray::t8_shmem_array_t, recvtype::Cint, comm::MPI_Comm)::Cvoid +function t8_forest_set_profiling(forest, set_profiling) + @ccall libt8.t8_forest_set_profiling(forest::Cint, set_profiling::Cint)::Cvoid end """ - t8_shmem_array_prefix(sendbuf, recvarray, count, type, op, comm) + t8_forest_compute_profile(forest) ### Prototype ```c -void t8_shmem_array_prefix (const void *sendbuf, t8_shmem_array_t recvarray, const int count, sc_MPI_Datatype type, sc_MPI_Op op, sc_MPI_Comm comm); +void t8_forest_compute_profile (t8_forest_t forest); ``` """ -function t8_shmem_array_prefix(sendbuf, recvarray, count, type, op, comm) - @ccall libt8.t8_shmem_array_prefix(sendbuf::Ptr{Cvoid}, recvarray::t8_shmem_array_t, count::Cint, type::Cint, op::Cint, comm::MPI_Comm)::Cvoid +function t8_forest_compute_profile(forest) + @ccall libt8.t8_forest_compute_profile(forest::Cint)::Cvoid end """ - t8_shmem_array_get_comm(array) + t8_forest_profile_get_adapt_stats(forest) ### Prototype ```c -sc_MPI_Comm t8_shmem_array_get_comm (t8_shmem_array_t array); +const sc_statinfo_t * t8_forest_profile_get_adapt_stats (t8_forest_t forest); ``` """ -function t8_shmem_array_get_comm(array) - @ccall libt8.t8_shmem_array_get_comm(array::t8_shmem_array_t)::Cint +function t8_forest_profile_get_adapt_stats(forest) + @ccall libt8.t8_forest_profile_get_adapt_stats(forest::Cint)::Ptr{sc_statinfo_t} end """ - t8_shmem_array_get_elem_size(array) - -Get the element size of a [`t8_shmem_array`](@ref) + t8_forest_profile_get_ghost_stats(forest) -# Arguments -* `array`:\\[in\\] The array. -# Returns -The element size of *array*'s elements. ### Prototype ```c -size_t t8_shmem_array_get_elem_size (t8_shmem_array_t array); +const sc_statinfo_t * t8_forest_profile_get_ghost_stats (t8_forest_t forest); ``` """ -function t8_shmem_array_get_elem_size(array) - @ccall libt8.t8_shmem_array_get_elem_size(array::t8_shmem_array_t)::Csize_t +function t8_forest_profile_get_ghost_stats(forest) + @ccall libt8.t8_forest_profile_get_ghost_stats(forest::Cint)::Ptr{sc_statinfo_t} end """ - t8_shmem_array_get_elem_count(array) - -Get the number of elements of a [`t8_shmem_array`](@ref) + t8_forest_profile_get_partition_stats(forest) -# Arguments -* `array`:\\[in\\] The array. -# Returns -The number of elements in *array*. ### Prototype ```c -size_t t8_shmem_array_get_elem_count (t8_shmem_array_t array); +const sc_statinfo_t * t8_forest_profile_get_partition_stats (t8_forest_t forest); ``` """ -function t8_shmem_array_get_elem_count(array) - @ccall libt8.t8_shmem_array_get_elem_count(array::t8_shmem_array_t)::Csize_t +function t8_forest_profile_get_partition_stats(forest) + @ccall libt8.t8_forest_profile_get_partition_stats(forest::Cint)::Ptr{sc_statinfo_t} end """ - t8_shmem_array_get_gloidx_array(array) - -Return a read-only pointer to the data of a shared memory array interpreted as an [`t8_gloidx_t`](@ref) array. - -!!! note - - Writing mode must be disabled for *array*. + t8_forest_profile_get_commit_stats(forest) -# Arguments -* `array`:\\[in\\] The [`t8_shmem_array`](@ref) -# Returns -The data of *array* as [`t8_gloidx_t`](@ref) pointer. ### Prototype ```c -const t8_gloidx_t * t8_shmem_array_get_gloidx_array (t8_shmem_array_t array); +const sc_statinfo_t * t8_forest_profile_get_commit_stats (t8_forest_t forest); ``` """ -function t8_shmem_array_get_gloidx_array(array) - @ccall libt8.t8_shmem_array_get_gloidx_array(array::t8_shmem_array_t)::Ptr{t8_gloidx_t} +function t8_forest_profile_get_commit_stats(forest) + @ccall libt8.t8_forest_profile_get_commit_stats(forest::Cint)::Ptr{sc_statinfo_t} end """ - t8_shmem_array_get_gloidx_array_for_writing(array) - -Return a pointer to the data of a shared memory array interpreted as an [`t8_gloidx_t`](@ref) array. The array must have writing enabled t8_shmem_array_start_writing and you should not write into the memory after t8_shmem_array_end_writing was called. + t8_forest_profile_get_balance_stats(forest) -# Arguments -* `array`:\\[in\\] The [`t8_shmem_array`](@ref) -# Returns -The data of *array* as [`t8_gloidx_t`](@ref) pointer. ### Prototype ```c -t8_gloidx_t * t8_shmem_array_get_gloidx_array_for_writing (t8_shmem_array_t array); +const sc_statinfo_t * t8_forest_profile_get_balance_stats (t8_forest_t forest); ``` """ -function t8_shmem_array_get_gloidx_array_for_writing(array) - @ccall libt8.t8_shmem_array_get_gloidx_array_for_writing(array::t8_shmem_array_t)::Ptr{t8_gloidx_t} +function t8_forest_profile_get_balance_stats(forest) + @ccall libt8.t8_forest_profile_get_balance_stats(forest::Cint)::Ptr{sc_statinfo_t} end """ - t8_shmem_array_get_gloidx(array, index) - -Return an entry of a shared memory array that stores [`t8_gloidx_t`](@ref). - -!!! note - - Writing mode must be disabled for *array*. + t8_forest_profile_get_balance_rounds_stats(forest) -# Arguments -* `array`:\\[in\\] The [`t8_shmem_array`](@ref) -* `index`:\\[in\\] The index of the entry to be queried. -# Returns -The *index*-th entry of *array* as [`t8_gloidx_t`](@ref). ### Prototype ```c -t8_gloidx_t t8_shmem_array_get_gloidx (t8_shmem_array_t array, int index); +const sc_statinfo_t * t8_forest_profile_get_balance_rounds_stats (t8_forest_t forest); ``` """ -function t8_shmem_array_get_gloidx(array, index) - @ccall libt8.t8_shmem_array_get_gloidx(array::t8_shmem_array_t, index::Cint)::t8_gloidx_t +function t8_forest_profile_get_balance_rounds_stats(forest) + @ccall libt8.t8_forest_profile_get_balance_rounds_stats(forest::Cint)::Ptr{sc_statinfo_t} end """ - t8_shmem_array_get_array(array) - -Return a pointer to the data array of a [`t8_shmem_array`](@ref). - -!!! note - - Writing mode must be disabled for *array*. + t8_forest_print_profile(forest) -# Arguments -* `array`:\\[in\\] The [`t8_shmem_array`](@ref). -# Returns -A pointer to the data array of *array*. ### Prototype ```c -const void * t8_shmem_array_get_array (t8_shmem_array_t array); +void t8_forest_print_profile (t8_forest_t forest); ``` """ -function t8_shmem_array_get_array(array) - @ccall libt8.t8_shmem_array_get_array(array::t8_shmem_array_t)::Ptr{Cvoid} +function t8_forest_print_profile(forest) + @ccall libt8.t8_forest_print_profile(forest::Cint)::Cvoid end """ - t8_shmem_array_index(array, index) - -Return a read-only pointer to an element in a [`t8_shmem_array`](@ref). - -!!! note - - You should not modify the value. - -!!! note - - Writing mode must be disabled for *array*. + t8_forest_profile_get_adapt_time(forest) -# Arguments -* `array`:\\[in\\] The [`t8_shmem_array`](@ref). -* `index`:\\[in\\] The index of an element. -# Returns -A pointer to the element at *index* in *array*. ### Prototype ```c -const void * t8_shmem_array_index (t8_shmem_array_t array, size_t index); +double t8_forest_profile_get_adapt_time (t8_forest_t forest); ``` """ -function t8_shmem_array_index(array, index) - @ccall libt8.t8_shmem_array_index(array::t8_shmem_array_t, index::Csize_t)::Ptr{Cvoid} +function t8_forest_profile_get_adapt_time(forest) + @ccall libt8.t8_forest_profile_get_adapt_time(forest::Cint)::Cdouble end """ - t8_shmem_array_index_for_writing(array, index) - -Return a pointer to an element in a [`t8_shmem_array`](@ref) in writing mode. - -!!! note - - You can modify the value before the next call to t8_shmem_array_end_writing. - -!!! note - - Writing mode must be enabled for *array*. + t8_forest_profile_get_partition_time(forest, procs_sent) -# Arguments -* `array`:\\[in\\] The [`t8_shmem_array`](@ref). -* `index`:\\[in\\] The index of an element. -# Returns -A pointer to the element at *index* in *array*. ### Prototype ```c -void * t8_shmem_array_index_for_writing (t8_shmem_array_t array, size_t index); +double t8_forest_profile_get_partition_time (t8_forest_t forest, int *procs_sent); ``` -""" -function t8_shmem_array_index_for_writing(array, index) - @ccall libt8.t8_shmem_array_index_for_writing(array::t8_shmem_array_t, index::Csize_t)::Ptr{Cvoid} +""" +function t8_forest_profile_get_partition_time(forest, procs_sent) + @ccall libt8.t8_forest_profile_get_partition_time(forest::Cint, procs_sent::Ptr{Cint})::Cdouble end """ - t8_shmem_array_is_equal(array_a, array_b) + t8_forest_profile_get_balance_time(forest, balance_rounds) ### Prototype ```c -int t8_shmem_array_is_equal (t8_shmem_array_t array_a, t8_shmem_array_t array_b); +double t8_forest_profile_get_balance_time (t8_forest_t forest, int *balance_rounds); ``` """ -function t8_shmem_array_is_equal(array_a, array_b) - @ccall libt8.t8_shmem_array_is_equal(array_a::t8_shmem_array_t, array_b::t8_shmem_array_t)::Cint +function t8_forest_profile_get_balance_time(forest, balance_rounds) + @ccall libt8.t8_forest_profile_get_balance_time(forest::Cint, balance_rounds::Ptr{Cint})::Cdouble end """ - t8_shmem_array_destroy(parray) - -Free all memory associated with a [`t8_shmem_array`](@ref). + t8_forest_profile_get_ghost_time(forest, ghosts_sent) -# Arguments -* `parray`:\\[in,out\\] On input a pointer to a valid [`t8_shmem_array`](@ref). This array is freed and *parray* is set to NULL on return. ### Prototype ```c -void t8_shmem_array_destroy (t8_shmem_array_t *parray); +double t8_forest_profile_get_ghost_time (t8_forest_t forest, t8_locidx_t *ghosts_sent); ``` """ -function t8_shmem_array_destroy(parray) - @ccall libt8.t8_shmem_array_destroy(parray::Ptr{t8_shmem_array_t})::Cvoid +function t8_forest_profile_get_ghost_time(forest, ghosts_sent) + @ccall libt8.t8_forest_profile_get_ghost_time(forest::Cint, ghosts_sent::Ptr{Cint})::Cdouble end """ - t8_forest_adapt(forest) + t8_forest_profile_get_ghostexchange_waittime(forest) ### Prototype ```c -void t8_forest_adapt (t8_forest_t forest); +double t8_forest_profile_get_ghostexchange_waittime (t8_forest_t forest); ``` """ -function t8_forest_adapt(forest) - @ccall libt8.t8_forest_adapt(forest::t8_forest_t)::Cvoid +function t8_forest_profile_get_ghostexchange_waittime(forest) + @ccall libt8.t8_forest_profile_get_ghostexchange_waittime(forest::Cint)::Cdouble end """ - t8_forest_balance(forest, repartition) + t8_forest_profile_get_cmesh_offsets_runtime(forest) ### Prototype ```c -void t8_forest_balance (t8_forest_t forest, int repartition); +double t8_forest_profile_get_cmesh_offsets_runtime (t8_forest_t forest); ``` """ -function t8_forest_balance(forest, repartition) - @ccall libt8.t8_forest_balance(forest::t8_forest_t, repartition::Cint)::Cvoid +function t8_forest_profile_get_cmesh_offsets_runtime(forest) + @ccall libt8.t8_forest_profile_get_cmesh_offsets_runtime(forest::Cint)::Cdouble end """ - t8_forest_is_balanced(forest) + t8_forest_profile_get_forest_offsets_runtime(forest) ### Prototype ```c -int t8_forest_is_balanced (t8_forest_t forest); +double t8_forest_profile_get_forest_offsets_runtime (t8_forest_t forest); ``` """ -function t8_forest_is_balanced(forest) - @ccall libt8.t8_forest_is_balanced(forest::t8_forest_t)::Cint +function t8_forest_profile_get_forest_offsets_runtime(forest) + @ccall libt8.t8_forest_profile_get_forest_offsets_runtime(forest::Cint)::Cdouble end """ - t8_tree + t8_forest_profile_get_first_descendant_runtime(forest) -The t8 tree datatype - -| Field | Note | -| :---------------- | :----------------------------------------------------------------- | -| elements | locally stored elements | -| eclass | The element class of this tree | -| first\\_desc | first local descendant | -| last\\_desc | last local descendant | -| elements\\_offset | cumulative sum over earlier trees on this processor (locals only) | +### Prototype +```c +double t8_forest_profile_get_first_descendant_runtime (t8_forest_t forest); +``` """ -struct t8_tree - elements::t8_element_array_t - eclass::t8_eclass_t - first_desc::Ptr{t8_element_t} - last_desc::Ptr{t8_element_t} - elements_offset::t8_locidx_t +function t8_forest_profile_get_first_descendant_runtime(forest) + @ccall libt8.t8_forest_profile_get_first_descendant_runtime(forest::Cint)::Cdouble end -const t8_tree_t = Ptr{t8_tree} - """ - t8_ghost_type_t - -This type controls, which neighbors count as ghost elements. Currently, we support face-neighbors. Vertex and edge neighbors will eventually be added. + t8_profile -| Enumerator | Note | -| :-------------------- | :---------------------------------------------------------------- | -| T8\\_GHOST\\_NONE | Do not create ghost layer. | -| T8\\_GHOST\\_FACES | Consider all face (codimension 1) neighbors. | -| T8\\_GHOST\\_EDGES | Consider all edge (codimension 2) and face neighbors. | -| T8\\_GHOST\\_VERTICES | Consider all vertex (codimension 3) and edge and face neighbors. | +This struct holds profiling information, such as timings or statistics about communication. + +| Field | Note | +| :----------------------------- | :------------------------------------------------------------------------------------------------------------- | +| partition\\_elements\\_shipped | The number of elements this process has sent to other in the last partition call. | +| partition\\_elements\\_recv | The number of elements this process has received from other in the last partition call. | +| partition\\_bytes\\_sent | The total number of bytes sent to other processes in the last partition call. | +| partition\\_procs\\_sent | The number of different processes this process has send local elements to in the last partition call. | +| ghosts\\_shipped | The number of ghost elements this process has sent to other processes. | +| ghosts\\_received | The number of ghost elements this process has received from other processes. | +| ghosts\\_remotes | The number of processes this process have sent ghost elements to (and received from). | +| balance\\_rounds | The number of iterations during balance. | +| adapt\\_runtime | The runtime of the last call to [`t8_forest_adapt`](@ref) (not counting adaptation in t8\\_forest\\_balance). | +| partition\\_runtime | The runtime of the last call to *t8_cmesh_partition* (not count in partition in t8\\_forest\\_balance). | +| ghost\\_runtime | The runtime of the last call to [`t8_forest_ghost_create`](@ref). | +| ghost\\_waittime | Amount of synchronisation time in ghost. | +| balance\\_runtime | The runtime of the last call to *t8_forest_balance*. | +| commit\\_runtime | The runtime of the last call to [`t8_cmesh_commit`](@ref). | +| cmesh\\_offsets\\_runtime | The runtime of the last call to [`t8_forest_partition_create_tree_offsets`](@ref). | +| forest\\_offsets\\_runtime | The runtime of the last call to [`t8_forest_partition_create_offsets`](@ref). | +| first\\_descendant\\_runtime | The runtime of the last call to [`t8_forest_partition_create_first_desc`](@ref). | """ -@cenum t8_ghost_type_t::UInt32 begin - T8_GHOST_NONE = 0 - T8_GHOST_FACES = 1 - T8_GHOST_EDGES = 2 - T8_GHOST_VERTICES = 3 +struct t8_profile + partition_elements_shipped::t8_locidx_t + partition_elements_recv::t8_locidx_t + partition_bytes_sent::Csize_t + partition_procs_sent::Cint + ghosts_shipped::t8_locidx_t + ghosts_received::t8_locidx_t + ghosts_remotes::Cint + balance_rounds::Cint + adapt_runtime::Cdouble + partition_runtime::Cdouble + ghost_runtime::Cdouble + ghost_waittime::Cdouble + balance_runtime::Cdouble + commit_runtime::Cdouble + cmesh_offsets_runtime::Cdouble + forest_offsets_runtime::Cdouble + first_descendant_runtime::Cdouble end -# typedef void ( * t8_generic_function_pointer ) ( void ) -""" -This typedef is needed as a helper construct to properly be able to define a function that returns a pointer to a void fun(void) function. +"""This struct holds profiling information, such as timings or statistics about communication.""" +const t8_profile_t = t8_profile -# See also -[`t8_forest_get_user_function`](@ref). -""" -const t8_generic_function_pointer = Ptr{Cvoid} +"""If a forest is to be derived from another forest, there are different possibilities how the original forest is modified. Currently we support: Copying, adapting, partitioning, and balancing a forest. The latter 3 can be combined, in which case the order is 1. Adapt, 2. Partition, 3. Balance. We store the methods in an int8\\_t and use these defines to distinguish between them.""" +const t8_forest_from_t = Int8 -# typedef void ( * t8_forest_replace_t ) ( t8_forest_t forest_old , t8_forest_t forest_new , t8_locidx_t which_tree , t8_eclass_scheme_c * ts , const int refine , const int num_outgoing , const t8_locidx_t first_outgoing , const int num_incoming , const t8_locidx_t first_incoming ) -""" -Callback function prototype to replace one set of elements with another. +"""This structure is private to the implementation.""" +const t8_forest_struct_t = t8_forest -This is used by the replace routine which can be called after adapt, when the elements of an existing, valid forest are changed. The callback allows the user to make changes to the elements of the new forest that are either refined, coarsened or the same as elements in the old forest. +"""The t8 tree datatype""" +const t8_tree_struct_t = t8_tree -If an element is being refined, *refine* and *num_outgoing* will be 1 and *num_incoming* will be the number of children. If a family is being coarsened, *refine* will be -1, *num_outgoing* will be the number of family members and *num_incoming* will be 1. If an element is being removed, *refine* and *num_outgoing* will be 1 and *num_incoming* will be 0. Else *refine* will be 0 and *num_outgoing* and *num_incoming* will both be 1. +"""This struct holds profiling information, such as timings or statistics about communication.""" +const t8_profile_struct_t = t8_profile -# Arguments -* `forest_old`:\\[in\\] The forest that is adapted -* `forest_new`:\\[in\\] The forest that is newly constructed from *forest_old* -* `which_tree`:\\[in\\] The local tree containing *first_outgoing* and *first_incoming* -* `ts`:\\[in\\] The eclass scheme of the tree -* `refine`:\\[in\\] -1 if family in *forest_old* got coarsened, 0 if element has not been touched, 1 if element got refined and -2 if element got removed. See return of [`t8_forest_adapt_t`](@ref). -* `num_outgoing`:\\[in\\] The number of outgoing elements. -* `first_outgoing`:\\[in\\] The tree local index of the first outgoing element. 0 <= first\\_outgoing < which\\_tree->num\\_elements -* `num_incoming`:\\[in\\] The number of incoming elements. -* `first_incoming`:\\[in\\] The tree local index of the first incoming element. 0 <= first\\_incom < new\\_which\\_tree->num\\_elements -# See also -[`t8_forest_iterate_replace`](@ref) -""" -const t8_forest_replace_t = Ptr{Cvoid} +"""This struct stores various information about a forest's ghost elements and ghost trees.""" +const t8_forest_ghost_struct_t = t8_forest_ghost -# typedef int ( * t8_forest_adapt_t ) ( t8_forest_t forest , t8_forest_t forest_from , t8_locidx_t which_tree , t8_locidx_t lelement_id , t8_eclass_scheme_c * ts , const int is_family , const int num_elements , t8_element_t * elements [ ] ) -""" -Callback function prototype to decide for refining and coarsening. If *is_family* equals 1, the first *num_elements* in *elements* form a family and we decide whether this family should be coarsened or only the first element should be refined. Otherwise *is_family* must equal zero and we consider the first entry of the element array for refinement. Entries of the element array beyond the first *num_elements* are undefined. +# typedef int ( * t8_fortran_adapt_coordinate_callback ) ( double x , double y , double z , int is_family ) +const t8_fortran_adapt_coordinate_callback = Ptr{Cvoid} -# Arguments -* `forest`:\\[in\\] the forest to which the new elements belong -* `forest_from`:\\[in\\] the forest that is adapted. -* `which_tree`:\\[in\\] the local tree containing *elements* -* `lelement_id`:\\[in\\] the local element id in *forest_old* in the tree of the current element -* `ts`:\\[in\\] the eclass scheme of the tree -* `is_family`:\\[in\\] if 1, the first *num_elements* entries in *elements* form a family. If 0, they do not. -* `num_elements`:\\[in\\] the number of entries in *elements* that are defined -* `elements`:\\[in\\] Pointers to a family or, if *is_family* is zero, pointer to one element. -# Returns -1 if the first entry in *elements* should be refined, -1 if the family *elements* shall be coarsened, -2 if the first entry in *elements* should be removed, 0 else. -""" -const t8_forest_adapt_t = Ptr{Cvoid} +const MPI_T8_Fint = Cint """ - t8_forest_init(pforest) - -Create a new forest with reference count one. This forest needs to be specialized with the t8\\_forest\\_set\\_* calls. Currently it is mandatory to either call the functions t8_forest_set_mpicomm, t8_forest_set_cmesh, and t8_forest_set_scheme, or to call one of t8_forest_set_copy, t8_forest_set_adapt, or t8_forest_set_partition. It is illegal to mix these calls, or to call more than one of the three latter functions Then it needs to be set up with t8_forest_commit. + t8_fortran_init_all(comm) -# Arguments -* `pforest`:\\[in,out\\] On input, this pointer must be non-NULL. On return, this pointer set to the new forest. ### Prototype ```c -void t8_forest_init (t8_forest_t *pforest); +void t8_fortran_init_all (sc_MPI_Comm *comm); ``` """ -function t8_forest_init(pforest) - @ccall libt8.t8_forest_init(pforest::Ptr{t8_forest_t})::Cvoid +function t8_fortran_init_all(comm) + @ccall libt8.t8_fortran_init_all(comm::Ptr{Cint})::Cvoid end +# no prototype is found for this function at t8_fortran_interface.h:67:1, please use with caution """ - t8_forest_is_initialized(forest) + t8_fortran_finalize() -Check whether a forest is not NULL, initialized and not committed. In addition, it asserts that the forest is consistent as much as possible. +Finalize sc. This wraps [`sc_finalize`](@ref) in order to have consistent naming with [`t8_fortran_init_all`](@ref). -# Arguments -* `forest`:\\[in\\] This forest is examined. May be NULL. -# Returns -True if forest is not NULL, t8_forest_init has been called on it, but not t8_forest_commit. False otherwise. ### Prototype ```c -int t8_forest_is_initialized (t8_forest_t forest); +void t8_fortran_finalize (); ``` """ -function t8_forest_is_initialized(forest) - @ccall libt8.t8_forest_is_initialized(forest::t8_forest_t)::Cint +function t8_fortran_finalize() + @ccall libt8.t8_fortran_finalize()::Cvoid end """ - t8_forest_is_committed(forest) - -Check whether a forest is not NULL, initialized and committed. In addition, it asserts that the forest is consistent as much as possible. + t8_fortran_cmesh_commit(cmesh, comm) -# Arguments -* `forest`:\\[in\\] This forest is examined. May be NULL. -# Returns -True if forest is not NULL and t8_forest_init has been called on it as well as t8_forest_commit. False otherwise. ### Prototype ```c -int t8_forest_is_committed (t8_forest_t forest); +void t8_fortran_cmesh_commit (t8_cmesh_t cmesh, sc_MPI_Comm *comm); ``` """ -function t8_forest_is_committed(forest) - @ccall libt8.t8_forest_is_committed(forest::t8_forest_t)::Cint +function t8_fortran_cmesh_commit(cmesh, comm) + @ccall libt8.t8_fortran_cmesh_commit(cmesh::t8_cmesh_t, comm::Ptr{Cint})::Cvoid end """ - t8_forest_no_overlap(forest) + t8_fortran_cmesh_set_join_by_stash_noConn(cmesh, do_both_directions) -Check whether the forest has local overlapping elements. +This function calls [`t8_cmesh_set_join_by_stash`](@ref) with connectivity = NULL. + +!!! warning + + This routine might be too expensive for very large meshes. In this case, consider to use a fully featured mesh generator. !!! note - This function is collective, but only checks local overlapping on each process. + This routine does not detect periodic boundaries. # Arguments -* `forest`:\\[in\\] The forest to consider. -# Returns -True if *forest* has no elements which are inside each other. -# See also -[`t8_forest_partition_test_boundary_element`](@ref) if you also want to test for global overlap across the process boundaries. - +* `cmesh`:\\[in,out\\] Pointer to a t8code cmesh object. If set to NULL this argument is ignored. +* `do_both_directions`:\\[in\\] Compute the connectivity from both neighboring sides. Takes much longer to compute. ### Prototype ```c -int t8_forest_no_overlap (t8_forest_t forest); +void t8_fortran_cmesh_set_join_by_stash_noConn (t8_cmesh_t cmesh, const int do_both_directions); ``` """ -function t8_forest_no_overlap(forest) - @ccall libt8.t8_forest_no_overlap(forest::t8_forest_t)::Cint +function t8_fortran_cmesh_set_join_by_stash_noConn(cmesh, do_both_directions) + @ccall libt8.t8_fortran_cmesh_set_join_by_stash_noConn(cmesh::t8_cmesh_t, do_both_directions::Cint)::Cvoid end """ - t8_forest_is_equal(forest_a, forest_b) - -Check whether two committed forests have the same local elements. - -!!! note - - This function is not collective. It only returns the state on the current rank. + t8_fortran_MPI_Comm_new(Fcomm) -# Arguments -* `forest_a`:\\[in\\] The first forest. -* `forest_b`:\\[in\\] The second forest. -# Returns -True if *forest_a* and *forest_b* do have the same number of local trees and each local tree has the same elements, that is t8_element_equal returns true for each pair of elements of *forest_a* and *forest_b*. ### Prototype ```c -int t8_forest_is_equal (t8_forest_t forest_a, t8_forest_t forest_b); +sc_MPI_Comm * t8_fortran_MPI_Comm_new (MPI_T8_Fint Fcomm); ``` """ -function t8_forest_is_equal(forest_a, forest_b) - @ccall libt8.t8_forest_is_equal(forest_a::t8_forest_t, forest_b::t8_forest_t)::Cint +function t8_fortran_MPI_Comm_new(Fcomm) + @ccall libt8.t8_fortran_MPI_Comm_new(Fcomm::MPI_T8_Fint)::Ptr{Cint} end """ - t8_forest_set_cmesh(forest, cmesh, comm) + t8_fortran_MPI_Comm_delete(Ccomm) ### Prototype ```c -void t8_forest_set_cmesh (t8_forest_t forest, t8_cmesh_t cmesh, sc_MPI_Comm comm); +void t8_fortran_MPI_Comm_delete (sc_MPI_Comm *Ccomm); ``` """ -function t8_forest_set_cmesh(forest, cmesh, comm) - @ccall libt8.t8_forest_set_cmesh(forest::t8_forest_t, cmesh::t8_cmesh_t, comm::MPI_Comm)::Cvoid +function t8_fortran_MPI_Comm_delete(Ccomm) + @ccall libt8.t8_fortran_MPI_Comm_delete(Ccomm::Ptr{Cint})::Cvoid end """ - t8_forest_set_scheme(forest, scheme) - -Set the element scheme associated to a forest. By default, the forest takes ownership of the scheme such that it will be destroyed when the forest is destroyed. To keep ownership of the scheme, call t8_scheme_ref before passing it to t8_forest_set_scheme. This means that it is ILLEGAL to continue using scheme or dereferencing it UNLESS it is referenced directly before passing it into this function. + t8_cmesh_new_periodic_tri_wrap(Ccomm) -# Arguments -* `forest`:\\[in,out\\] The forest whose scheme variable will be set. -* `scheme`:\\[in\\] The scheme to be set. We take ownership. This can be prevented by referencing **scheme**. ### Prototype ```c -void t8_forest_set_scheme (t8_forest_t forest, t8_scheme_cxx_t *scheme); +t8_cmesh_t t8_cmesh_new_periodic_tri_wrap (sc_MPI_Comm *Ccomm); ``` """ -function t8_forest_set_scheme(forest, scheme) - @ccall libt8.t8_forest_set_scheme(forest::t8_forest_t, scheme::Ptr{t8_scheme_cxx_t})::Cvoid +function t8_cmesh_new_periodic_tri_wrap(Ccomm) + @ccall libt8.t8_cmesh_new_periodic_tri_wrap(Ccomm::Ptr{Cint})::t8_cmesh_t end """ - t8_forest_set_level(forest, level) - -Set the initial refinement level to be used when **forest** is committed. + t8_forest_new_uniform_default(cmesh, level, do_face_ghost, comm) -!!! note +### Prototype +```c +t8_forest_t t8_forest_new_uniform_default (t8_cmesh_t cmesh, int level, int do_face_ghost, sc_MPI_Comm *comm); +``` +""" +function t8_forest_new_uniform_default(cmesh, level, do_face_ghost, comm) + @ccall libt8.t8_forest_new_uniform_default(cmesh::t8_cmesh_t, level::Cint, do_face_ghost::Cint, comm::Ptr{Cint})::t8_forest_t +end - This setting cannot be combined with any of the derived forest methods (t8_forest_set_copy, t8_forest_set_adapt, t8_forest_set_partition, and t8_forest_set_balance) and overwrites any of these settings. If this function is used, then the forest is created from scratch as a uniform refinement of the specified cmesh (t8_forest_set_cmesh, t8_forest_set_scheme). +""" + t8_forest_adapt_by_coordinates(forest, recursive, callback) # Arguments -* `forest`:\\[in,out\\] The forest whose level will be set. -* `level`:\\[in\\] The initial refinement level of **forest**, when it is committed. +* `forest`:\\[in,out\\] The forest +* `recursive`:\\[in\\] A flag specifying whether adaptation is to be done recursively or not. If the value is zero, adaptation is not recursive and it is recursive otherwise. +* `callback`:\\[in\\] A pointer to a user defined function. t8code will never touch the function. ### Prototype ```c -void t8_forest_set_level (t8_forest_t forest, int level); +t8_forest_t t8_forest_adapt_by_coordinates (t8_forest_t forest, int recursive, t8_fortran_adapt_coordinate_callback callback); ``` """ -function t8_forest_set_level(forest, level) - @ccall libt8.t8_forest_set_level(forest::t8_forest_t, level::Cint)::Cvoid +function t8_forest_adapt_by_coordinates(forest, recursive, callback) + @ccall libt8.t8_forest_adapt_by_coordinates(forest::t8_forest_t, recursive::Cint, callback::t8_fortran_adapt_coordinate_callback)::t8_forest_t end """ - t8_forest_set_copy(forest, from) - -Set a forest as source for copying on committing. By default, the forest takes ownership of the source **from** such that it will be destroyed on calling t8_forest_commit. To keep ownership of **from**, call t8_forest_ref before passing it into this function. This means that it is ILLEGAL to continue using **from** or dereferencing it UNLESS it is referenced directly before passing it into this function. - -!!! note + t8_global_productionf_noargs(string) - This setting cannot be combined with t8_forest_set_adapt, t8_forest_set_partition, or t8_forest_set_balance and overwrites these settings. +Log a message on the root rank with priority [`SC_LP_PRODUCTION`](@ref). # Arguments -* `forest`:\\[in,out\\] The forest. -* `from`:\\[in\\] A second forest from which *forest* will be copied in t8_forest_commit. +* `string`:\\[in\\] String to log. ### Prototype ```c -void t8_forest_set_copy (t8_forest_t forest, const t8_forest_t from); +void t8_global_productionf_noargs (const char *string); ``` """ -function t8_forest_set_copy(forest, from) - @ccall libt8.t8_forest_set_copy(forest::t8_forest_t, from::t8_forest_t)::Cvoid +function t8_global_productionf_noargs(string) + @ccall libt8.t8_global_productionf_noargs(string::Cstring)::Cvoid end """ - t8_forest_set_adapt(forest, set_from, adapt_fn, recursive) + t8_geometry_type -Set a source forest with an adapt function to be adapted on committing. By default, the forest takes ownership of the source **set_from** such that it will be destroyed on calling t8_forest_commit. To keep ownership of **set_from**, call t8_forest_ref before passing it into this function. This means that it is ILLEGAL to continue using **set_from** or dereferencing it UNLESS it is referenced directly before passing it into this function. +This enumeration contains all possible geometries. -!!! note +| Enumerator | Note | +| :--------------------------------------------- | :----------------------------------------------------------------------------------------------- | +| T8\\_GEOMETRY\\_TYPE\\_ZERO | The zero geometry maps all points to zero. | +| T8\\_GEOMETRY\\_TYPE\\_LINEAR | The linear geometry uses linear interpolations to interpolate between the tree vertices. | +| T8\\_GEOMETRY\\_TYPE\\_LINEAR\\_AXIS\\_ALIGNED | The linear, axis aligned geometry uses only 2 vertices, since it is axis aligned. | +| T8\\_GEOMETRY\\_TYPE\\_LAGRANGE | The Lagrange geometry uses a mapping with Lagrange polynomials to approximate curved elements . | +| T8\\_GEOMETRY\\_TYPE\\_ANALYTIC | The analytic geometry uses a user-defined analytic function to map into the physical domain. | +| T8\\_GEOMETRY\\_TYPE\\_CAD | The opencascade geometry uses CAD shapes to map trees exactly to the underlying CAD model. | +| T8\\_GEOMETRY\\_TYPE\\_COUNT | This is no geometry type but can be used as the number of geometry types. | +| T8\\_GEOMETRY\\_TYPE\\_INVALID | This is no geometry type but is used as error type to describe invalid geometries | +| T8\\_GEOMETRY\\_TYPE\\_UNDEFINED | This is no geometry type but is used for every geometry, where no type is defined | +""" +@cenum t8_geometry_type::UInt32 begin + T8_GEOMETRY_TYPE_ZERO = 0 + T8_GEOMETRY_TYPE_LINEAR = 1 + T8_GEOMETRY_TYPE_LINEAR_AXIS_ALIGNED = 2 + T8_GEOMETRY_TYPE_LAGRANGE = 3 + T8_GEOMETRY_TYPE_ANALYTIC = 4 + T8_GEOMETRY_TYPE_CAD = 5 + T8_GEOMETRY_TYPE_COUNT = 6 + T8_GEOMETRY_TYPE_INVALID = 7 + T8_GEOMETRY_TYPE_UNDEFINED = 8 +end + +"""This enumeration contains all possible geometries.""" +const t8_geometry_type_t = t8_geometry_type - This setting can be combined with t8_forest_set_partition and t8_forest_set_balance. The order in which these operations are executed is always 1) Adapt 2) Balance 3) Partition +mutable struct t8_geometry_handler end -!!! note +"""This typedef holds virtual functions for the geometry handler. We need it so that we can use [`t8_geometry_handler_c`](@ref) pointers in .c files without them seeing the actual C++ code (and then not compiling) TODO: Delete this when the cmesh is a proper cpp class.""" +const t8_geometry_handler_c = t8_geometry_handler - This setting may not be combined with t8_forest_set_copy and overwrites this setting. +""" + t8_geometry_evaluate(cmesh, gtreeid, ref_coords, num_coords, out_coords) -# Arguments -* `forest`:\\[in,out\\] The forest -* `set_from`:\\[in\\] The source forest from which **forest** will be adapted. We take ownership. This can be prevented by referencing **set_from**. If NULL, a previously (or later) set forest will be taken (t8_forest_set_partition, t8_forest_set_balance). -* `adapt_fn`:\\[in\\] The adapt function used on committing. -* `recursive`:\\[in\\] A flag specifying whether adaptation is to be done recursively or not. If the value is zero, adaptation is not recursive and it is recursive otherwise. +Evaluates the geometry of a tree at a given reference point. + +# Arguments +* `cmesh`:\\[in\\] The cmesh +* `gtreeid`:\\[in\\] The global id of the tree +* `ref_coords`:\\[in\\] The reference coordinates at which to evaluate the geometry +* `num_coords`:\\[in\\] The number of reference coordinates +* `out_coords`:\\[out\\] The evaluated coordinates ### Prototype ```c -void t8_forest_set_adapt (t8_forest_t forest, const t8_forest_t set_from, t8_forest_adapt_t adapt_fn, int recursive); +void t8_geometry_evaluate (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, double *out_coords); ``` """ -function t8_forest_set_adapt(forest, set_from, adapt_fn, recursive) - @ccall libt8.t8_forest_set_adapt(forest::t8_forest_t, set_from::t8_forest_t, adapt_fn::t8_forest_adapt_t, recursive::Cint)::Cvoid +function t8_geometry_evaluate(cmesh, gtreeid, ref_coords, num_coords, out_coords) + @ccall libt8.t8_geometry_evaluate(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, out_coords::Ptr{Cdouble})::Cvoid end """ - t8_forest_set_user_data(forest, data) + t8_geometry_jacobian(cmesh, gtreeid, ref_coords, num_coords, jacobian) -Set the user data of a forest. This can i.e. be used to pass user defined arguments to the adapt routine. +Evaluates the jacobian of a tree at a given reference point. # Arguments -* `forest`:\\[in,out\\] The forest -* `data`:\\[in\\] A pointer to user data. t8code will never touch the data. The forest does not need be committed before calling this function. -# See also -[`t8_forest_get_user_data`](@ref) - +* `cmesh`:\\[in\\] The cmesh +* `gtreeid`:\\[in\\] The global id of the tree +* `ref_coords`:\\[in\\] The reference coordinates at which to evaluate the jacobian +* `num_coords`:\\[in\\] The number of reference coordinates +* `jacobian`:\\[out\\] The jacobian at the reference coordinates ### Prototype ```c -void t8_forest_set_user_data (t8_forest_t forest, void *data); +void t8_geometry_jacobian (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, double *jacobian); ``` """ -function t8_forest_set_user_data(forest, data) - @ccall libt8.t8_forest_set_user_data(forest::t8_forest_t, data::Ptr{Cvoid})::Cvoid +function t8_geometry_jacobian(cmesh, gtreeid, ref_coords, num_coords, jacobian) + @ccall libt8.t8_geometry_jacobian(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, jacobian::Ptr{Cdouble})::Cvoid end """ - t8_forest_get_user_data(forest) + t8_geometry_get_type(cmesh, gtreeid) -Return the user data pointer associated with a forest. +This function returns the geometry type of a tree. # Arguments -* `forest`:\\[in\\] The forest. +* `cmesh`:\\[in\\] The cmesh +* `gtreeid`:\\[in\\] The global id of the tree # Returns -The user data pointer of *forest*. The forest does not need be committed before calling this function. -# See also -[`t8_forest_set_user_data`](@ref) - +The geometry type of the tree with id *gtreeid* ### Prototype ```c -void * t8_forest_get_user_data (const t8_forest_t forest); +t8_geometry_type_t t8_geometry_get_type (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); ``` """ -function t8_forest_get_user_data(forest) - @ccall libt8.t8_forest_get_user_data(forest::t8_forest_t)::Ptr{Cvoid} +function t8_geometry_get_type(cmesh, gtreeid) + @ccall libt8.t8_geometry_get_type(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t)::t8_geometry_type_t end """ - t8_forest_set_user_function(forest, _function) - -Set the user function pointer of a forest. This can i.e. be used to pass user defined functions to the adapt routine. - -!!! note + t8_geometry_tree_negative_volume(cmesh, gtreeid) - *function* can be an arbitrary function with return value and parameters of your choice. When accessing it with t8_forest_get_user_function you should cast it into the proper type. +Check if a tree has a negative volume # Arguments -* `forest`:\\[in,out\\] The forest -* `function`:\\[in\\] A pointer to a user defined function. t8code will never touch the function. The forest does not need be committed before calling this function. -# See also -[`t8_forest_get_user_function`](@ref) - +* `cmesh`:\\[in\\] The cmesh to check +* `gtreeid`:\\[in\\] The global id of the tree +# Returns +True if the tree with id *gtreeid* has a negative volume. False otherwise. ### Prototype ```c -void t8_forest_set_user_function (t8_forest_t forest, t8_generic_function_pointer function); +int t8_geometry_tree_negative_volume (const t8_cmesh_t cmesh, const t8_gloidx_t gtreeid); ``` """ -function t8_forest_set_user_function(forest, _function) - @ccall libt8.t8_forest_set_user_function(forest::t8_forest_t, _function::t8_generic_function_pointer)::Cvoid +function t8_geometry_tree_negative_volume(cmesh, gtreeid) + @ccall libt8.t8_geometry_tree_negative_volume(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t)::Cint end """ - t8_forest_get_user_function(forest) + t8_geom_get_name(geom) -Return the user function pointer associated with a forest. +Get the name of a geometry. # Arguments -* `forest`:\\[in\\] The forest. +* `geom`:\\[in\\] A geometry. # Returns -The user function pointer of *forest*. The forest does not need be committed before calling this function. -# See also -[`t8_forest_set_user_function`](@ref) - +The name of *geom*. ### Prototype ```c -t8_generic_function_pointer t8_forest_get_user_function (const t8_forest_t forest); +const char * t8_geom_get_name (const t8_geometry_c *geom); ``` """ -function t8_forest_get_user_function(forest) - @ccall libt8.t8_forest_get_user_function(forest::t8_forest_t)::t8_generic_function_pointer +function t8_geom_get_name(geom) + @ccall libt8.t8_geom_get_name(geom::Ptr{t8_geometry_c})::Cstring end """ - t8_forest_set_partition(forest, set_from, set_for_coarsening) - -Set a source forest to be partitioned during commit. The partitioning is done according to the SFC and each rank is assigned the same (maybe +1) number of elements. - -!!! note - - This setting can be combined with t8_forest_set_adapt and t8_forest_set_balance. The order in which these operations are executed is always 1) Adapt 2) Balance 3) Partition If t8_forest_set_balance is called with the *no_repartition* parameter set as false, it is not necessary to call t8_forest_set_partition additionally. - -!!! note + t8_geom_get_type(geom) - This setting may not be combined with t8_forest_set_copy and overwrites this setting. +Get the type of a geometry. # Arguments -* `forest`:\\[in,out\\] The forest. -* `set_from`:\\[in\\] A second forest that should be partitioned. We take ownership. This can be prevented by referencing **set_from**. If NULL, a previously (or later) set forest will be taken (t8_forest_set_adapt, t8_forest_set_balance). -* `set_for_coarsening`:\\[in\\] CURRENTLY DISABLED. If true, then the partitions are choose such that coarsening an element once is a process local operation. +* `geom`:\\[in\\] A geometry. +# Returns +The type of *geom*. ### Prototype ```c -void t8_forest_set_partition (t8_forest_t forest, const t8_forest_t set_from, int set_for_coarsening); +t8_geometry_type_t t8_geom_get_type (const t8_geometry_c *geom); ``` """ -function t8_forest_set_partition(forest, set_from, set_for_coarsening) - @ccall libt8.t8_forest_set_partition(forest::t8_forest_t, set_from::t8_forest_t, set_for_coarsening::Cint)::Cvoid +function t8_geom_get_type(geom) + @ccall libt8.t8_geom_get_type(geom::Ptr{t8_geometry_c})::t8_geometry_type_t end """ - t8_forest_set_balance(forest, set_from, no_repartition) - -Set a source forest to be balanced during commit. A forest is said to be balanced if each element has face neighbors of level at most +1 or -1 of the element's level. - -!!! note - - This setting can be combined with t8_forest_set_adapt and t8_forest_set_balance. The order in which these operations are executed is always 1) Adapt 2) Balance 3) Partition. + t8_geom_compute_linear_geometry(tree_class, tree_vertices, ref_coords, num_coords, out_coords) -!!! note +### Prototype +```c +void t8_geom_compute_linear_geometry (t8_eclass_t tree_class, const double *tree_vertices, const double *ref_coords, const size_t num_coords, double *out_coords); +``` +""" +function t8_geom_compute_linear_geometry(tree_class, tree_vertices, ref_coords, num_coords, out_coords) + @ccall libt8.t8_geom_compute_linear_geometry(tree_class::Cint, tree_vertices::Ptr{Cdouble}, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, out_coords::Ptr{Cdouble})::Cvoid +end - This setting may not be combined with t8_forest_set_copy and overwrites this setting. +""" + t8_geom_compute_linear_axis_aligned_geometry(tree_class, tree_vertices, ref_coords, num_coords, out_coords) -# Arguments -* `forest`:\\[in,out\\] The forest. -* `set_from`:\\[in\\] A second forest that should be balanced. We take ownership. This can be prevented by referencing **set_from**. If NULL, a previously (or later) set forest will be taken (t8_forest_set_adapt, t8_forest_set_partition) -* `no_repartition`:\\[in\\] Balance constructs several intermediate forest that are refined from each other. In order to maintain a balanced load these forest are repartitioned in each round and the resulting forest is load-balanced per default. If this behaviour is not desired, *no_repartition* should be set to true. If *no_repartition* is false, an additional call of t8_forest_set_partition is not necessary. ### Prototype ```c -void t8_forest_set_balance (t8_forest_t forest, const t8_forest_t set_from, int no_repartition); +void t8_geom_compute_linear_axis_aligned_geometry (t8_eclass_t tree_class, const double *tree_vertices, const double *ref_coords, const size_t num_coords, double *out_coords); ``` """ -function t8_forest_set_balance(forest, set_from, no_repartition) - @ccall libt8.t8_forest_set_balance(forest::t8_forest_t, set_from::t8_forest_t, no_repartition::Cint)::Cvoid +function t8_geom_compute_linear_axis_aligned_geometry(tree_class, tree_vertices, ref_coords, num_coords, out_coords) + @ccall libt8.t8_geom_compute_linear_axis_aligned_geometry(tree_class::Cint, tree_vertices::Ptr{Cdouble}, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, out_coords::Ptr{Cdouble})::Cvoid end """ - t8_forest_set_ghost(forest, do_ghost, ghost_type) + t8_geom_linear_interpolation(coefficients, corner_values, corner_value_dim, interpolation_dim, evaluated_function) -Enable or disable the creation of a layer of ghost elements. On default no ghosts are created. +Interpolates linearly between 2, bilinearly between 4 or trilineraly between 8 points. # Arguments -* `forest`:\\[in\\] The forest. -* `do_ghost`:\\[in\\] If non-zero a ghost layer will be created. -* `ghost_type`:\\[in\\] Controls which neighbors count as ghost elements, currently only T8\\_GHOST\\_FACES is supported. This value is ignored if *do_ghost* = 0. +* `coefficients`:\\[in\\] An array of size at least dim giving the coefficients used for the interpolation +* `corner_values`:\\[in\\] An array of size 2^dim * 3, giving for each corner (in zorder) of the unit square/cube its function values in space. +* `corner_value_dim`:\\[in\\] The dimension of the *corner_values*. +* `interpolation_dim`:\\[in\\] The dimension of the interpolation (1 for linear, 2 for bilinear, 3 for trilinear) +* `evaluated_function`:\\[out\\] An array of size *corner_value_dim*, on output the result of the interpolation. ### Prototype ```c -void t8_forest_set_ghost (t8_forest_t forest, int do_ghost, t8_ghost_type_t ghost_type); +void t8_geom_linear_interpolation (const double *coefficients, const double *corner_values, int corner_value_dim, int interpolation_dim, double *evaluated_function); ``` """ -function t8_forest_set_ghost(forest, do_ghost, ghost_type) - @ccall libt8.t8_forest_set_ghost(forest::t8_forest_t, do_ghost::Cint, ghost_type::t8_ghost_type_t)::Cvoid +function t8_geom_linear_interpolation(coefficients, corner_values, corner_value_dim, interpolation_dim, evaluated_function) + @ccall libt8.t8_geom_linear_interpolation(coefficients::Ptr{Cdouble}, corner_values::Ptr{Cdouble}, corner_value_dim::Cint, interpolation_dim::Cint, evaluated_function::Ptr{Cdouble})::Cvoid end """ - t8_forest_set_ghost_ext(forest, do_ghost, ghost_type, ghost_version) + t8_geom_triangular_interpolation(coefficients, corner_values, corner_value_dim, interpolation_dim, evaluated_function) -Like t8_forest_set_ghost but with the additional options to change the ghost algorithm. This is used for debugging and timing the algorithm. An application should almost always use t8_forest_set_ghost. +Triangular interpolation between 3 points (triangle) or 4 points (tetrahedron) using cartesian coordinates. The input coefficients have to be given as coordinates in the reference triangle (interpolation\\_dim = 2) with points (0,0) (1,0) (1,1) or the reference tet (interpolation\\_dim = 3) with points (0,0,0) (1,0,0) (1,1,0) (1,1,1). # Arguments -* `ghost_version`:\\[in\\] If 1, the iterative ghost algorithm for balanced forests is used. If 2, the iterative algorithm for unbalanced forests. If 3, the top-down search algorithm for unbalanced forests. -# See also -[`t8_forest_set_ghost`](@ref) - +* `coefficients`:\\[in\\] An array of size *interpolation_dim* giving the coefficients in the reference triangle/tet used for the interpolation +* `corner_values`:\\[in\\] An array of size 3 * *corner_value_dim* for *interpolation_dim* == 2 or 4 * *corner_value_dim* for *interpolation_dim* == 3, giving the function values of the triangle/tetrahedron for each corner (in zorder) +* `corner_value_dim`:\\[in\\] The dimension of the *corner_values*. +* `interpolation_dim`:\\[in\\] The dimension of the interpolation (2 for triangle, 3 for tetrahedron) +* `evaluated_function`:\\[out\\] An array of size *corner_value_dim*, on output the result of the interpolation. ### Prototype ```c -void t8_forest_set_ghost_ext (t8_forest_t forest, int do_ghost, t8_ghost_type_t ghost_type, int ghost_version); +void t8_geom_triangular_interpolation (const double *coefficients, const double *corner_values, int corner_value_dim, int interpolation_dim, double *evaluated_function); ``` """ -function t8_forest_set_ghost_ext(forest, do_ghost, ghost_type, ghost_version) - @ccall libt8.t8_forest_set_ghost_ext(forest::t8_forest_t, do_ghost::Cint, ghost_type::t8_ghost_type_t, ghost_version::Cint)::Cvoid +function t8_geom_triangular_interpolation(coefficients, corner_values, corner_value_dim, interpolation_dim, evaluated_function) + @ccall libt8.t8_geom_triangular_interpolation(coefficients::Ptr{Cdouble}, corner_values::Ptr{Cdouble}, corner_value_dim::Cint, interpolation_dim::Cint, evaluated_function::Ptr{Cdouble})::Cvoid end """ - t8_forest_set_load(forest, filename) + t8_geom_get_face_vertices(tree_class, tree_vertices, face_index, dim, face_vertices) ### Prototype ```c -void t8_forest_set_load (t8_forest_t forest, const char *filename); +void t8_geom_get_face_vertices (t8_eclass_t tree_class, const double *tree_vertices, int face_index, int dim, double *face_vertices); ``` """ -function t8_forest_set_load(forest, filename) - @ccall libt8.t8_forest_set_load(forest::t8_forest_t, filename::Cstring)::Cvoid +function t8_geom_get_face_vertices(tree_class, tree_vertices, face_index, dim, face_vertices) + @ccall libt8.t8_geom_get_face_vertices(tree_class::Cint, tree_vertices::Ptr{Cdouble}, face_index::Cint, dim::Cint, face_vertices::Ptr{Cdouble})::Cvoid end """ - t8_forest_comm_global_num_elements(forest) - -Compute the global number of elements in a forest as the sum of the local element counts. + t8_geom_get_edge_vertices(tree_class, tree_vertices, edge_index, dim, edge_vertices) -# Arguments -* `forest`:\\[in\\] The forest. ### Prototype ```c -void t8_forest_comm_global_num_elements (t8_forest_t forest); +void t8_geom_get_edge_vertices (t8_eclass_t tree_class, const double *tree_vertices, int edge_index, int dim, double *edge_vertices); ``` """ -function t8_forest_comm_global_num_elements(forest) - @ccall libt8.t8_forest_comm_global_num_elements(forest::t8_forest_t)::Cvoid +function t8_geom_get_edge_vertices(tree_class, tree_vertices, edge_index, dim, edge_vertices) + @ccall libt8.t8_geom_get_edge_vertices(tree_class::Cint, tree_vertices::Ptr{Cdouble}, edge_index::Cint, dim::Cint, edge_vertices::Ptr{Cdouble})::Cvoid end """ - t8_forest_commit(forest) + t8_geom_get_ref_intersection(edge_index, ref_coords, ref_intersection) -After allocating and adding properties to a forest, commit the changes. This call sets up the internal state of the forest. +Calculates a point of intersection in a triangular reference space. The intersection is the extension of a straight line passing through a reference point and the opposite vertex of the edge. /|\\ / | \\ o -> reference point / o \\ x -> intersection point / | \\ /\\_\\_\\_\\_x\\_\\_\\_\\_\\ # Arguments -* `forest`:\\[in,out\\] Must be created with t8_forest_init and specialized with t8\\_forest\\_set\\_* calls first. +* `edge_index`:\\[in\\] Index of the edge, the intersection lies on. +* `ref_coords`:\\[in\\] Array containing the coordinates of the reference point. +* `ref_intersection`:\\[out\\] Coordinates of the intersection point. ### Prototype ```c -void t8_forest_commit (t8_forest_t forest); +void t8_geom_get_ref_intersection (int edge_index, const double *ref_coords, double ref_intersection[2]); ``` """ -function t8_forest_commit(forest) - @ccall libt8.t8_forest_commit(forest::t8_forest_t)::Cvoid +function t8_geom_get_ref_intersection(edge_index, ref_coords, ref_intersection) + @ccall libt8.t8_geom_get_ref_intersection(edge_index::Cint, ref_coords::Ptr{Cdouble}, ref_intersection::Ptr{Cdouble})::Cvoid end """ - t8_forest_get_maxlevel(forest) + t8_geom_get_triangle_scaling_factor(edge_index, tree_vertices, glob_intersection, glob_ref_point) -Return the maximum allowed refinement level for any element in a forest. +Calculates the scaling factor for edge displacement along a triangular tree face depending on the position of the global reference point. # Arguments -* `forest`:\\[in\\] A forest. -# Returns -The maximum level of refinement that is allowed for an element in this forest. It is guaranteed that any tree in *forest* can be refined this many times and it is not allowed to refine further. *forest* must be committed before calling this function. For forest with a single element class (non-hybrid) maxlevel is the maximum refinement level of this element class, whilst for hybrid forests the maxlevel is the minimum of all maxlevels of the element classes in this forest. +* `edge_index`:\\[in\\] Index of the edge, whose displacement should be scaled. +* `tree_vertices`:\\[in\\] Array with the tree vertex coordinates. +* `glob_intersection`:\\[in\\] Array containing the coordinates of the intersection point of a line drawn from the opposite vertex through the glob\\_ref\\_point onto the edge with edge\\_index. +* `glob_ref_point`:\\[in\\] Array containing the coordinates of the reference point mapped into the global space. ### Prototype ```c -int t8_forest_get_maxlevel (const t8_forest_t forest); +double t8_geom_get_triangle_scaling_factor (int edge_index, const double *tree_vertices, const double *glob_intersection, const double *glob_ref_point); ``` """ -function t8_forest_get_maxlevel(forest) - @ccall libt8.t8_forest_get_maxlevel(forest::t8_forest_t)::Cint +function t8_geom_get_triangle_scaling_factor(edge_index, tree_vertices, glob_intersection, glob_ref_point) + @ccall libt8.t8_geom_get_triangle_scaling_factor(edge_index::Cint, tree_vertices::Ptr{Cdouble}, glob_intersection::Ptr{Cdouble}, glob_ref_point::Ptr{Cdouble})::Cdouble end """ - t8_forest_get_local_num_elements(forest) + t8_geom_get_scaling_factor_of_edge_on_face_tet(edge_index, face_index, ref_coords) -Return the number of process local elements in the forest. +Calculates the scaling factor for the displacement of an edge over a face of a tetrahedral element. # Arguments -* `forest`:\\[in\\] A forest. +* `edge_index`:\\[in\\] Index of the edge, whose displacement should be scaled. +* `face_index`:\\[in\\] Index of the face, the displacement should be scaled on. +* `ref_coords`:\\[in\\] Array containing the coordinates of the reference point. # Returns -The number of elements on this process in *forest*. *forest* must be committed before calling this function. +The scaling factor of the edge displacement on the face at the point of the reference coordinates. ### Prototype ```c -t8_locidx_t t8_forest_get_local_num_elements (const t8_forest_t forest); +double t8_geom_get_scaling_factor_of_edge_on_face_tet (int edge_index, int face_index, const double *ref_coords); ``` """ -function t8_forest_get_local_num_elements(forest) - @ccall libt8.t8_forest_get_local_num_elements(forest::t8_forest_t)::t8_locidx_t +function t8_geom_get_scaling_factor_of_edge_on_face_tet(edge_index, face_index, ref_coords) + @ccall libt8.t8_geom_get_scaling_factor_of_edge_on_face_tet(edge_index::Cint, face_index::Cint, ref_coords::Ptr{Cdouble})::Cdouble end """ - t8_forest_get_global_num_elements(forest) + t8_geom_get_tet_face_intersection(face_index, ref_coords, face_intersection) -Return the number of global elements in the forest. +Calculates the face intersection of a ray passing trough the reference coordinates and the opposite vertex of that face for a tetrahedron. The coordinates of the face intersection are reference coordinates: [0,1]^3. # Arguments -* `forest`:\\[in\\] A forest. -# Returns -The number of elements (summed over all processes) in *forest*. *forest* must be committed before calling this function. +* `face_index`:\\[in\\] Index of the face, on which the intersection should be calculated. +* `ref_coords`:\\[in\\] Array containing the coordinates of the reference point. +* `face_intersection`:\\[out\\] Three dimensional array containing the intersection point on the face in reference space. ### Prototype ```c -t8_gloidx_t t8_forest_get_global_num_elements (const t8_forest_t forest); +void t8_geom_get_tet_face_intersection (const int face_index, const double *ref_coords, double face_intersection[3]); ``` """ -function t8_forest_get_global_num_elements(forest) - @ccall libt8.t8_forest_get_global_num_elements(forest::t8_forest_t)::t8_gloidx_t +function t8_geom_get_tet_face_intersection(face_index, ref_coords, face_intersection) + @ccall libt8.t8_geom_get_tet_face_intersection(face_index::Cint, ref_coords::Ptr{Cdouble}, face_intersection::Ptr{Cdouble})::Cvoid end """ - t8_forest_get_num_ghosts(forest) + t8_geom_get_scaling_factor_of_edge_on_face_prism(edge_index, face_index, ref_coords) -Return the number of ghost elements of a forest. +Calculates the scaling factor for the displacement of an edge over a face of a prism element. # Arguments -* `forest`:\\[in\\] The forest. +* `edge_index`:\\[in\\] Index of the edge, whose displacement should be scaled. +* `face_index`:\\[in\\] Index of the face, the displacement should be scaled on. +* `ref_coords`:\\[in\\] Array containing the coordinates of the reference point. # Returns -The number of ghost elements stored in the ghost structure of *forest*. 0 if no ghosts were constructed. -# See also -[`t8_forest_set_ghost`](@ref) *forest* must be committed before calling this function. - +The scaling factor of the edge displacement on the face at the point of the reference coordinates. ### Prototype ```c -t8_locidx_t t8_forest_get_num_ghosts (const t8_forest_t forest); +double t8_geom_get_scaling_factor_of_edge_on_face_prism (int edge_index, int face_index, const double *ref_coords); ``` """ -function t8_forest_get_num_ghosts(forest) - @ccall libt8.t8_forest_get_num_ghosts(forest::t8_forest_t)::t8_locidx_t +function t8_geom_get_scaling_factor_of_edge_on_face_prism(edge_index, face_index, ref_coords) + @ccall libt8.t8_geom_get_scaling_factor_of_edge_on_face_prism(edge_index::Cint, face_index::Cint, ref_coords::Ptr{Cdouble})::Cdouble end """ - t8_forest_get_eclass(forest, ltreeid) + t8_geom_get_scaling_factor_face_through_volume_prism(face, ref_coords) -Return the element class of a forest local tree. +Calculates the scaling factor for the displacement of an face through the volume of a prism element. # Arguments -* `forest`:\\[in\\] The forest. -* `ltreeid`:\\[in\\] The local id of a tree in *forest*. +* `face`:\\[in\\] Index of the displaced face. +* `ref_coords`:\\[in\\] Array containing the coordinates of the reference point. # Returns -The element class of the tree *ltreeid*. *forest* must be committed before calling this function. +The scaling factor of the face displacement at the point of the reference coordinates inside the prism volume. ### Prototype ```c -t8_eclass_t t8_forest_get_eclass (const t8_forest_t forest, const t8_locidx_t ltreeid); +double t8_geom_get_scaling_factor_face_through_volume_prism (const int face, const double *ref_coords); ``` """ -function t8_forest_get_eclass(forest, ltreeid) - @ccall libt8.t8_forest_get_eclass(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_eclass_t +function t8_geom_get_scaling_factor_face_through_volume_prism(face, ref_coords) + @ccall libt8.t8_geom_get_scaling_factor_face_through_volume_prism(face::Cint, ref_coords::Ptr{Cdouble})::Cdouble end """ - t8_forest_tree_is_local(forest, local_tree) + t8_vertex_point_inside(vertex_coords, point, tolerance) -Check whether a given tree id belongs to a local tree in a forest. +Check if a point lies inside a vertex # Arguments -* `forest`:\\[in\\] The forest. -* `local_tree`:\\[in\\] A tree id. +* `vertex_coords`:\\[in\\] The coordinates of the vertex +* `point`:\\[in\\] The coordinates of the point to check +* `tolerance`:\\[in\\] A double > 0 defining the tolerance # Returns -True if and only if the id *local_tree* belongs to a local tree of *forest*. *forest* must be committed before calling this function. +0 if the point is outside, 1 otherwise. ### Prototype ```c -int t8_forest_tree_is_local (const t8_forest_t forest, const t8_locidx_t local_tree); +int t8_vertex_point_inside (const double vertex_coords[3], const double point[3], const double tolerance); ``` """ -function t8_forest_tree_is_local(forest, local_tree) - @ccall libt8.t8_forest_tree_is_local(forest::t8_forest_t, local_tree::t8_locidx_t)::Cint +function t8_vertex_point_inside(vertex_coords, point, tolerance) + @ccall libt8.t8_vertex_point_inside(vertex_coords::Ptr{Cdouble}, point::Ptr{Cdouble}, tolerance::Cdouble)::Cint end """ - t8_forest_get_local_id(forest, gtreeid) + t8_line_point_inside(p_0, vec, point, tolerance) -Given a global tree id compute the forest local id of this tree. If the tree is a local tree, then the local id is between 0 and the number of local trees. If the tree is not a local tree, a negative number is returned. +Check if a point is inside a line that is defined by a starting point *p_0* and a vector *vec* # Arguments -* `forest`:\\[in\\] The forest. -* `gtreeid`:\\[in\\] The global id of a tree. +* `p_0`:\\[in\\] Starting point of the line +* `vec`:\\[in\\] Direction of the line (not normalized) +* `point`:\\[in\\] The coordinates of the point to check +* `tolerance`:\\[in\\] A double > 0 defining the tolerance # Returns -The tree's local id in *forest*, if it is a local tree. A negative number if not. -# See also -https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. - +0 if the point is outside, 1 otherwise. ### Prototype ```c -t8_locidx_t t8_forest_get_local_id (const t8_forest_t forest, const t8_gloidx_t gtreeid); +int t8_line_point_inside (const double *p_0, const double *vec, const double *point, const double tolerance); ``` """ -function t8_forest_get_local_id(forest, gtreeid) - @ccall libt8.t8_forest_get_local_id(forest::t8_forest_t, gtreeid::t8_gloidx_t)::t8_locidx_t +function t8_line_point_inside(p_0, vec, point, tolerance) + @ccall libt8.t8_line_point_inside(p_0::Ptr{Cdouble}, vec::Ptr{Cdouble}, point::Ptr{Cdouble}, tolerance::Cdouble)::Cint end """ - t8_forest_get_local_or_ghost_id(forest, gtreeid) + t8_triangle_point_inside(p_0, v, w, point, tolerance) -Given a global tree id compute the forest local id of this tree. If the tree is a local tree, then the local id is between 0 and the number of local trees. If the tree is a ghost, then the local id is between num\\_local\\_trees and num\\_local\\_trees + num\\_ghost\\_trees. If the tree is neither a local tree nor a ghost tree, a negative number is returned. +Check if a point is inside of a triangle described by a point *p_0* and two vectors *v* and *w*. # Arguments -* `forest`:\\[in\\] The forest. -* `gtreeid`:\\[in\\] The global id of a tree. +* `p_0`:\\[in\\] The first vertex of a triangle +* `v`:\\[in\\] The vector from p\\_0 to p\\_1 (second vertex in the triangle) +* `w`:\\[in\\] The vector from p\\_0 to p\\_2 (third vertex in the triangle) +* `point`:\\[in\\] The coordinates of the point to check +* `tolerance`:\\[in\\] A double > 0 defining the tolerance # Returns -The tree's local id in *forest*, if it is a local tree. num\\_local\\_trees + the ghosts id, if it is a ghost tree. A negative number if not. -# See also -https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. - +0 if the point is outside, 1 otherwise. ### Prototype ```c -t8_locidx_t t8_forest_get_local_or_ghost_id (const t8_forest_t forest, const t8_gloidx_t gtreeid); +int t8_triangle_point_inside (const double p_0[3], const double v[3], const double w[3], const double point[3], const double tolerance); ``` """ -function t8_forest_get_local_or_ghost_id(forest, gtreeid) - @ccall libt8.t8_forest_get_local_or_ghost_id(forest::t8_forest_t, gtreeid::t8_gloidx_t)::t8_locidx_t +function t8_triangle_point_inside(p_0, v, w, point, tolerance) + @ccall libt8.t8_triangle_point_inside(p_0::Ptr{Cdouble}, v::Ptr{Cdouble}, w::Ptr{Cdouble}, point::Ptr{Cdouble}, tolerance::Cdouble)::Cint end """ - t8_forest_ltreeid_to_cmesh_ltreeid(forest, ltreeid) - -Given the local id of a tree in a forest, compute the tree's local id in the associated cmesh. - -!!! note + t8_plane_point_inside(point_on_face, face_normal, point) - For forest local trees, this is the inverse function of t8_forest_cmesh_ltreeid_to_ltreeid. +Check if a point lays on the inner side of a plane of a bilinearly interpolated volume element. the plane is described by a point and the normal of the face. # Arguments -* `forest`:\\[in\\] The forest. -* `ltreeid`:\\[in\\] The local id of a tree or ghost in the forest. +* `point_on_face`:\\[in\\] A point on the plane +* `face_normal`:\\[in\\] The normal of the face +* `point`:\\[in\\] The point to check # Returns -The local id of the tree in the cmesh associated with the forest. *forest* must be committed before calling this function. -# See also -https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. - +0 if the point is outside, 1 otherwise. ### Prototype ```c -t8_locidx_t t8_forest_ltreeid_to_cmesh_ltreeid (t8_forest_t forest, t8_locidx_t ltreeid); +int t8_plane_point_inside (const double point_on_face[3], const double face_normal[3], const double point[3]); ``` """ -function t8_forest_ltreeid_to_cmesh_ltreeid(forest, ltreeid) - @ccall libt8.t8_forest_ltreeid_to_cmesh_ltreeid(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_locidx_t +function t8_plane_point_inside(point_on_face, face_normal, point) + @ccall libt8.t8_plane_point_inside(point_on_face::Ptr{Cdouble}, face_normal::Ptr{Cdouble}, point::Ptr{Cdouble})::Cint end """ - t8_forest_cmesh_ltreeid_to_ltreeid(forest, lctreeid) - -Given the local id of a tree in the coarse mesh of a forest, compute the tree's local id in the forest. - -!!! note + t8_cmesh_set_tree_vertices(cmesh, gtree_id, vertices, num_vertices) - For forest local trees, this is the inverse function of t8_forest_ltreeid_to_cmesh_ltreeid. +Set the vertex coordinates of a tree in the cmesh. This is currently inefficient, since the vertices are duplicated for each tree. Eventually this function will be replaced by a more efficient one. It is not allowed to call this function after t8_cmesh_commit. The eclass of the tree has to be set before calling this function. # Arguments -* `forest`:\\[in\\] The forest. -* `ltreeid`:\\[in\\] The local id of a tree in the coarse mesh of *forest*. -# Returns -The local id of the tree in the forest. -1 if the tree is not forest local. *forest* must be committed before calling this function. -# See also -https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. - +* `cmesh`:\\[in,out\\] The cmesh to be updated. +* `gtree_id`:\\[in\\] The global number of the tree. +* `vertices`:\\[in\\] An array of 3 doubles per tree vertex. +* `num_vertices`:\\[in\\] The number of verticess in *vertices*. Must match the number of corners of the tree. ### Prototype ```c -t8_locidx_t t8_forest_cmesh_ltreeid_to_ltreeid (t8_forest_t forest, t8_locidx_t lctreeid); +void t8_cmesh_set_tree_vertices (t8_cmesh_t cmesh, const t8_gloidx_t gtree_id, const double *vertices, const int num_vertices); ``` """ -function t8_forest_cmesh_ltreeid_to_ltreeid(forest, lctreeid) - @ccall libt8.t8_forest_cmesh_ltreeid_to_ltreeid(forest::t8_forest_t, lctreeid::t8_locidx_t)::t8_locidx_t +function t8_cmesh_set_tree_vertices(cmesh, gtree_id, vertices, num_vertices) + @ccall libt8.t8_cmesh_set_tree_vertices(cmesh::t8_cmesh_t, gtree_id::t8_gloidx_t, vertices::Ptr{Cdouble}, num_vertices::Cint)::Cvoid end """ - t8_forest_get_coarse_tree(forest, ltreeid) + t8_scheme_ref(scheme) -Given the local id of a tree in a forest, return the coarse tree of the cmesh that corresponds to this tree. +Increase the reference counter of a scheme. # Arguments -* `forest`:\\[in\\] The forest. -* `ltreeid`:\\[in\\] The local id of a tree in the forest. -# Returns -The coarse tree that matches the forest tree with local id *ltreeid*. +* `scheme`:\\[in,out\\] On input, this scheme must be alive, that is, exist with positive reference count. ### Prototype ```c -t8_ctree_t t8_forest_get_coarse_tree (t8_forest_t forest, t8_locidx_t ltreeid); +void t8_scheme_ref (t8_scheme_c *scheme); ``` """ -function t8_forest_get_coarse_tree(forest, ltreeid) - @ccall libt8.t8_forest_get_coarse_tree(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_ctree_t +function t8_scheme_ref(scheme) + @ccall libt8.t8_scheme_ref(scheme::Ptr{t8_scheme_c})::Cvoid end """ - t8_forest_element_is_leaf(forest, element, local_tree) - -Query whether a given element is a leaf in a forest. - -!!! note - - This does not query for ghost leaves. + t8_scheme_unref(pscheme) -!!! note - - *forest* must be committed before calling this function. +Decrease the reference counter of a scheme. If the counter reaches zero, this scheme is destroyed. # Arguments -* `forest`:\\[in\\] The forest. -* `element`:\\[in\\] An element of a local tree in *forest*. -* `local_tree`:\\[in\\] A local tree id of *forest*. -# Returns -True (non-zero) if and only if *element* is a leaf in *local_tree* of *forest*. +* `pscheme`:\\[in,out\\] On input, the scheme pointed to must exist with positive reference count. If the reference count reaches zero, the scheme is destroyed and this pointer set to NULL. Otherwise, the pointer is not changed and the scheme is not modified in other ways. ### Prototype ```c -int t8_forest_element_is_leaf (const t8_forest_t forest, const t8_element_t *element, const t8_locidx_t local_tree); +void t8_scheme_unref (t8_scheme_c **pscheme); ``` """ -function t8_forest_element_is_leaf(forest, element, local_tree) - @ccall libt8.t8_forest_element_is_leaf(forest::t8_forest_t, element::Ptr{t8_element_t}, local_tree::t8_locidx_t)::Cint +function t8_scheme_unref(pscheme) + @ccall libt8.t8_scheme_unref(pscheme::Ptr{Ptr{t8_scheme_c}})::Cvoid end """ - t8_forest_leaf_face_orientation(forest, ltreeid, ts, leaf, face) - -Compute the leaf face orientation at given face in a forest. + t8_element_get_element_size(scheme, tree_class) -For more information about the encoding of face orientation refer to t8_cmesh_get_face_neighbor. +Return the size of any element of a given class. -# Arguments -* `forest`:\\[in\\] The forest. Must have a valid ghost layer. -* `ltreeid`:\\[in\\] A local tree id. -* `ts`:\\[in\\] The eclass scheme of the element. -* `leaf`:\\[in\\] A leaf in tree *ltreeid* of *forest*. -* `face`:\\[in\\] The index of the face across which the face neighbors are searched. # Returns -Face orientation encoded as integer. +The size of an element of class **ts**. We provide a default implementation of this routine that should suffice for most use cases. ### Prototype ```c -int t8_forest_leaf_face_orientation (t8_forest_t forest, const t8_locidx_t ltreeid, const t8_eclass_scheme_c *ts, const t8_element_t *leaf, int face); +size_t t8_element_get_element_size (const t8_scheme_c *scheme, const t8_eclass_t tree_class); ``` """ -function t8_forest_leaf_face_orientation(forest, ltreeid, ts, leaf, face) - @ccall libt8.t8_forest_leaf_face_orientation(forest::t8_forest_t, ltreeid::t8_locidx_t, ts::Ptr{t8_eclass_scheme_c}, leaf::Ptr{t8_element_t}, face::Cint)::Cint +function t8_element_get_element_size(scheme, tree_class) + @ccall libt8.t8_element_get_element_size(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t)::Csize_t end """ - t8_forest_leaf_face_neighbors(forest, ltreeid, leaf, pneighbor_leaves, face, dual_faces, num_neighbors, pelement_indices, pneigh_scheme, forest_is_balanced) - -Compute the leaf face neighbors of a forest. - -!!! note - - If there are no face neighbors, then *neighbor\\_leaves = NULL, num\\_neighbors = 0, and *pelement\\_indices = NULL on output. - -!!! note + t8_element_refines_irregular(scheme, tree_class) - Currently *forest* must be balanced. - -!!! note - - *forest* must be committed before calling this function. - -!!! note - - Important! This routine allocates memory which must be freed. Do it like this: - -if (num\\_neighbors > 0) { eclass\\_scheme->[`t8_element_destroy`](@ref) (num\\_neighbors, neighbors); [`T8_FREE`](@ref) (pneighbor\\_leaves); [`T8_FREE`](@ref) (pelement\\_indices); [`T8_FREE`](@ref) (dual\\_faces); } +Returns true, if there is one element in the tree, that does not refine into 2^dim children. Returns false otherwise. -# Arguments -* `forest`:\\[in\\] The forest. Must have a valid ghost layer. -* `ltreeid`:\\[in\\] A local tree id. -* `leaf`:\\[in\\] A leaf in tree *ltreeid* of *forest*. -* `pneighbor_leaves`:\\[out\\] Unallocated on input. On output the neighbor leaves are stored here. -* `face`:\\[in\\] The index of the face across which the face neighbors are searched. -* `dual_faces`:\\[out\\] On output the face id's of the neighboring elements' faces. -* `num_neighbors`:\\[out\\] On output the number of neighbor leaves. -* `pelement_indices`:\\[out\\] Unallocated on input. On output the element indices of the neighbor leaves are stored here. 0, 1, ... num\\_local\\_el - 1 for local leaves and num\\_local\\_el , ... , num\\_local\\_el + num\\_ghosts - 1 for ghosts. -* `pneigh_scheme`:\\[out\\] On output the eclass scheme of the neighbor elements. -* `forest_is_balanced`:\\[in\\] True if we know that *forest* is balanced, false otherwise. ### Prototype ```c -void t8_forest_leaf_face_neighbors (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *leaf, t8_element_t **pneighbor_leaves[], int face, int *dual_faces[], int *num_neighbors, t8_locidx_t **pelement_indices, t8_eclass_scheme_c **pneigh_scheme, int forest_is_balanced); +int t8_element_refines_irregular (const t8_scheme_c *scheme, const t8_eclass_t tree_class); ``` """ -function t8_forest_leaf_face_neighbors(forest, ltreeid, leaf, pneighbor_leaves, face, dual_faces, num_neighbors, pelement_indices, pneigh_scheme, forest_is_balanced) - @ccall libt8.t8_forest_leaf_face_neighbors(forest::t8_forest_t, ltreeid::t8_locidx_t, leaf::Ptr{t8_element_t}, pneighbor_leaves::Ptr{Ptr{Ptr{t8_element_t}}}, face::Cint, dual_faces::Ptr{Ptr{Cint}}, num_neighbors::Ptr{Cint}, pelement_indices::Ptr{Ptr{t8_locidx_t}}, pneigh_scheme::Ptr{Ptr{t8_eclass_scheme_c}}, forest_is_balanced::Cint)::Cvoid +function t8_element_refines_irregular(scheme, tree_class) + @ccall libt8.t8_element_refines_irregular(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t)::Cint end """ - t8_forest_leaf_face_neighbors_ext(forest, ltreeid, leaf, pneighbor_leaves, face, dual_faces, num_neighbors, pelement_indices, pneigh_scheme, forest_is_balanced, gneigh_tree, orientation) - -Like t8_forest_leaf_face_neighbors but also provides information about the global neighbors and the orientation. - -!!! note - - If there are no face neighbors, then *neighbor\\_leaves = NULL, num\\_neighbors = 0, and *pelement\\_indices = NULL on output. - -!!! note - - Currently *forest* must be balanced. - -!!! note - - *forest* must be committed before calling this function. - -!!! note - - Important! This routine allocates memory which must be freed. Do it like this: + t8_element_get_maxlevel(scheme, tree_class) -if (num\\_neighbors > 0) { eclass\\_scheme->[`t8_element_destroy`](@ref) (num\\_neighbors, neighbors); [`T8_FREE`](@ref) (pneighbor\\_leaves); [`T8_FREE`](@ref) (pelement\\_indices); [`T8_FREE`](@ref) (dual\\_faces); } +Return the maximum allowed level for any element of a given class. # Arguments -* `forest`:\\[in\\] The forest. Must have a valid ghost layer. -* `ltreeid`:\\[in\\] A local tree id. -* `leaf`:\\[in\\] A leaf in tree *ltreeid* of *forest*. -* `pneighbor_leaves`:\\[out\\] Unallocated on input. On output the neighbor leaves are stored here. -* `face`:\\[in\\] The index of the face across which the face neighbors are searched. -* `dual_faces`:\\[out\\] On output the face id's of the neighboring elements' faces. -* `num_neighbors`:\\[out\\] On output the number of neighbor leaves. -* `pelement_indices`:\\[out\\] Unallocated on input. On output the element indices of the neighbor leaves are stored here. 0, 1, ... num\\_local\\_el - 1 for local leaves and num\\_local\\_el , ... , num\\_local\\_el + num\\_ghosts - 1 for ghosts. -* `pneigh_scheme`:\\[out\\] On output the eclass scheme of the neighbor elements. -* `forest_is_balanced`:\\[in\\] True if we know that *forest* is balanced, false otherwise. -* `gneigh_tree`:\\[out\\] The global tree IDs of the neighbor trees. -* `orientation`:\\[out\\] If not NULL on input, the face orientation is computed and stored here. Thus, if the face connection is an inter-tree connection the orientation of the tree-to-tree connection is stored. Otherwise, the value 0 is stored. All other parameters and behavior are identical to `t8_forest_leaf_face_neighbors`. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +# Returns +The maximum allowed level for elements of class **ts**. ### Prototype ```c -void t8_forest_leaf_face_neighbors_ext (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *leaf, t8_element_t **pneighbor_leaves[], int face, int *dual_faces[], int *num_neighbors, t8_locidx_t **pelement_indices, t8_eclass_scheme_c **pneigh_scheme, int forest_is_balanced, t8_gloidx_t *gneigh_tree, int *orientation); +int t8_element_get_maxlevel (const t8_scheme_c *scheme, const t8_eclass_t tree_class); ``` """ -function t8_forest_leaf_face_neighbors_ext(forest, ltreeid, leaf, pneighbor_leaves, face, dual_faces, num_neighbors, pelement_indices, pneigh_scheme, forest_is_balanced, gneigh_tree, orientation) - @ccall libt8.t8_forest_leaf_face_neighbors_ext(forest::t8_forest_t, ltreeid::t8_locidx_t, leaf::Ptr{t8_element_t}, pneighbor_leaves::Ptr{Ptr{Ptr{t8_element_t}}}, face::Cint, dual_faces::Ptr{Ptr{Cint}}, num_neighbors::Ptr{Cint}, pelement_indices::Ptr{Ptr{t8_locidx_t}}, pneigh_scheme::Ptr{Ptr{t8_eclass_scheme_c}}, forest_is_balanced::Cint, gneigh_tree::Ptr{t8_gloidx_t}, orientation::Ptr{Cint})::Cvoid +function t8_element_get_maxlevel(scheme, tree_class) + @ccall libt8.t8_element_get_maxlevel(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t)::Cint end """ - t8_forest_ghost_exchange_data(forest, element_data) - -Exchange ghost information of user defined element data. - -!!! note + t8_element_get_level(scheme, tree_class, element) - This function is collective and hence must be called by all processes in the forest's MPI Communicator. +Return the level of an element. # Arguments -* `forest`:\\[in\\] The forest. Must be committed. -* `element_data`:\\[in\\] An array of length num\\_local\\_elements + num\\_ghosts storing one value for each local element and ghost in *forest*. After calling this function the entries for the ghost elements are update with the entries in the *element_data* array of the corresponding owning process. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. +# Returns +The level of *element*. ### Prototype ```c -void t8_forest_ghost_exchange_data (t8_forest_t forest, sc_array_t *element_data); +int t8_element_get_level (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element); ``` """ -function t8_forest_ghost_exchange_data(forest, element_data) - @ccall libt8.t8_forest_ghost_exchange_data(forest::t8_forest_t, element_data::Ptr{sc_array_t})::Cvoid +function t8_element_get_level(scheme, tree_class, element) + @ccall libt8.t8_element_get_level(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t})::Cint end """ - t8_forest_ghost_print(forest) + t8_element_copy(scheme, tree_class, source, dest) -Print the ghost structure of a forest. Only used for debugging. +Copy all entries of **source** to **dest**. **dest** must be an existing element. No memory is allocated by this function. + +!!! note + + *source* and *dest* may point to the same element. +# Arguments +* `scheme`:\\[in\\] Implementation of a class scheme. +* `tree_class`:\\[in\\] The eclass of the current tree. +* `source`:\\[in\\] The element whose entries will be copied to **dest**. +* `dest`:\\[in,out\\] This element's entries will be overwritten with the entries of **source**. ### Prototype ```c -void t8_forest_ghost_print (t8_forest_t forest); +void t8_element_copy (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *source, t8_element_t *dest); ``` """ -function t8_forest_ghost_print(forest) - @ccall libt8.t8_forest_ghost_print(forest::t8_forest_t)::Cvoid +function t8_element_copy(scheme, tree_class, source, dest) + @ccall libt8.t8_element_copy(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, source::Ptr{t8_element_t}, dest::Ptr{t8_element_t})::Cvoid end """ - t8_forest_partition_cmesh(forest, comm, set_profiling) + t8_element_compare(scheme, tree_class, elem1, elem2) + +Compare two elements with respect to the scheme. +# Arguments +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `elem1`:\\[in\\] The first element. +* `elem2`:\\[in\\] The second element. +# Returns +negative if elem1 < elem2, zero if elem1 equals elem2 and positive if elem1 > elem2. If elem2 is a copy of elem1 then the elements are equal. ### Prototype ```c -void t8_forest_partition_cmesh (t8_forest_t forest, sc_MPI_Comm comm, int set_profiling); +int t8_element_compare (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *elem1, const t8_element_t *elem2); ``` """ -function t8_forest_partition_cmesh(forest, comm, set_profiling) - @ccall libt8.t8_forest_partition_cmesh(forest::t8_forest_t, comm::MPI_Comm, set_profiling::Cint)::Cvoid +function t8_element_compare(scheme, tree_class, elem1, elem2) + @ccall libt8.t8_element_compare(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, elem1::Ptr{t8_element_t}, elem2::Ptr{t8_element_t})::Cint end """ - t8_forest_get_mpicomm(forest) + t8_element_is_equal(scheme, tree_class, elem1, elem2) + +Check if two elements are equal. +# Arguments +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `elem1`:\\[in\\] The first element. +* `elem2`:\\[in\\] The second element. +# Returns +1 if the elements are equal, 0 if they are not equal ### Prototype ```c -sc_MPI_Comm t8_forest_get_mpicomm (const t8_forest_t forest); +int t8_element_is_equal (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *elem1, const t8_element_t *elem2); ``` """ -function t8_forest_get_mpicomm(forest) - @ccall libt8.t8_forest_get_mpicomm(forest::t8_forest_t)::MPI_Comm +function t8_element_is_equal(scheme, tree_class, elem1, elem2) + @ccall libt8.t8_element_is_equal(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, elem1::Ptr{t8_element_t}, elem2::Ptr{t8_element_t})::Cint end """ - t8_forest_get_first_local_tree_id(forest) + element_is_refinable(scheme, tree_class, element) -Return the global id of the first local tree of a forest. +Indicates if an element is refinable. Possible reasons for being not refinable could be that the element has reached its max level. # Arguments -* `forest`:\\[in\\] The forest. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element to check. # Returns -The global id of the first local tree in *forest*. +1 if the element is refinable, 0 otherwise. ### Prototype ```c -t8_gloidx_t t8_forest_get_first_local_tree_id (const t8_forest_t forest); +int element_is_refinable (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element); ``` """ -function t8_forest_get_first_local_tree_id(forest) - @ccall libt8.t8_forest_get_first_local_tree_id(forest::t8_forest_t)::t8_gloidx_t +function element_is_refinable(scheme, tree_class, element) + @ccall libt8.element_is_refinable(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t})::Cint end """ - t8_forest_get_num_local_trees(forest) + t8_element_get_parent(scheme, tree_class, element, parent) -Return the number of local trees of a given forest. +Compute the parent of a given element **element** and store it in **parent**. **parent** needs to be an existing element. No memory is allocated by this function. **element** and **parent** can point to the same element, then the entries of **element** are overwritten by the ones of its parent. # Arguments -* `forest`:\\[in\\] The forest. -# Returns -The number of local trees of that forest. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element whose parent will be computed. +* `parent`:\\[in,out\\] This element's entries will be overwritten by those of **element**'s parent. The storage for this element must exist and match the element class of the parent. ### Prototype ```c -t8_locidx_t t8_forest_get_num_local_trees (const t8_forest_t forest); +void t8_element_get_parent (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, t8_element_t *parent); ``` """ -function t8_forest_get_num_local_trees(forest) - @ccall libt8.t8_forest_get_num_local_trees(forest::t8_forest_t)::t8_locidx_t +function t8_element_get_parent(scheme, tree_class, element, parent) + @ccall libt8.t8_element_get_parent(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, parent::Ptr{t8_element_t})::Cvoid end """ - t8_forest_get_num_ghost_trees(forest) + t8_element_get_num_siblings(scheme, tree_class, element) -Return the number of ghost trees of a given forest. +Compute the number of siblings of an element. That is the number of Children of its parent. # Arguments -* `forest`:\\[in\\] The forest. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. # Returns -The number of ghost trees of that forest. +The number of siblings of *element*. Note that this number is >= 1, since we count the element itself as a sibling. ### Prototype ```c -t8_locidx_t t8_forest_get_num_ghost_trees (const t8_forest_t forest); +int t8_element_get_num_siblings (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element); ``` """ -function t8_forest_get_num_ghost_trees(forest) - @ccall libt8.t8_forest_get_num_ghost_trees(forest::t8_forest_t)::t8_locidx_t +function t8_element_get_num_siblings(scheme, tree_class, element) + @ccall libt8.t8_element_get_num_siblings(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t})::Cint end """ - t8_forest_get_num_global_trees(forest) + t8_element_get_sibling(scheme, tree_class, element, sibid, sibling) -Return the number of global trees of a given forest. +Compute a specific sibling of a given element **element** and store it in **sibling**. **sibling** needs to be an existing element. No memory is allocated by this function. **element** and **sibling** can point to the same element, then the entries of **element** are overwritten by the ones of its i-th sibling. # Arguments -* `forest`:\\[in\\] The forest. -# Returns -The number of global trees of that forest. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element whose sibling will be computed. +* `sibid`:\\[in\\] The id of the sibling computed. +* `sibling`:\\[in,out\\] This element's entries will be overwritten by those of **element**'s sibid-th sibling. The storage for this element must exist and match the element class of the sibling. ### Prototype ```c -t8_gloidx_t t8_forest_get_num_global_trees (const t8_forest_t forest); +void t8_element_get_sibling (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, const int sibid, t8_element_t *sibling); ``` """ -function t8_forest_get_num_global_trees(forest) - @ccall libt8.t8_forest_get_num_global_trees(forest::t8_forest_t)::t8_gloidx_t +function t8_element_get_sibling(scheme, tree_class, element, sibid, sibling) + @ccall libt8.t8_element_get_sibling(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, sibid::Cint, sibling::Ptr{t8_element_t})::Cvoid end """ - t8_forest_global_tree_id(forest, ltreeid) + t8_element_get_num_corners(scheme, tree_class, element) -Return the global id of a local tree or a ghost tree. +Compute the number of corners of an element. # Arguments -* `forest`:\\[in\\] The forest. -* `ltreeid`:\\[in\\] An id 0 <= *ltreeid* < num\\_local\\_trees + num\\_ghosts specifying a local tree or ghost tree. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. # Returns -The global id corresponding to the tree with local id *ltreeid*. *forest* must be committed before calling this function. -# See also -https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. - +The number of corners of *element*. ### Prototype ```c -t8_gloidx_t t8_forest_global_tree_id (const t8_forest_t forest, const t8_locidx_t ltreeid); +int t8_element_get_num_corners (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element); ``` """ -function t8_forest_global_tree_id(forest, ltreeid) - @ccall libt8.t8_forest_global_tree_id(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_gloidx_t +function t8_element_get_num_corners(scheme, tree_class, element) + @ccall libt8.t8_element_get_num_corners(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t})::Cint end """ - t8_forest_get_tree(forest, ltree_id) + t8_element_get_num_faces(scheme, tree_class, element) -Return a pointer to a tree in a forest. +Compute the number of faces of an element. # Arguments -* `forest`:\\[in\\] The forest. -* `ltree_id`:\\[in\\] The local id of the tree. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. # Returns -A pointer to the tree with local id *ltree_id*. *forest* must be committed before calling this function. +The number of faces of *element*. ### Prototype ```c -t8_tree_t t8_forest_get_tree (const t8_forest_t forest, const t8_locidx_t ltree_id); +int t8_element_get_num_faces (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element); ``` """ -function t8_forest_get_tree(forest, ltree_id) - @ccall libt8.t8_forest_get_tree(forest::t8_forest_t, ltree_id::t8_locidx_t)::t8_tree_t +function t8_element_get_num_faces(scheme, tree_class, element) + @ccall libt8.t8_element_get_num_faces(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t})::Cint end """ - t8_forest_get_tree_vertices(forest, ltreeid) + t8_element_get_max_num_faces(scheme, tree_class, element) -Return a pointer to the vertex coordinates of a tree. +Compute the maximum number of faces of a given element and all of its descendants. # Arguments -* `forest`:\\[in\\] The forest. -* `ltreeid`:\\[in\\] The id of a local tree. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. # Returns -If stored, a pointer to the vertex coordinates of *tree*. If no coordinates for this tree are found, NULL. +The number of faces of *element*. ### Prototype ```c -double * t8_forest_get_tree_vertices (t8_forest_t forest, t8_locidx_t ltreeid); +int t8_element_get_max_num_faces (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element); ``` """ -function t8_forest_get_tree_vertices(forest, ltreeid) - @ccall libt8.t8_forest_get_tree_vertices(forest::t8_forest_t, ltreeid::t8_locidx_t)::Ptr{Cdouble} +function t8_element_get_max_num_faces(scheme, tree_class, element) + @ccall libt8.t8_element_get_max_num_faces(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t})::Cint end """ - t8_forest_tree_get_leaves(forest, ltree_id) + t8_element_get_num_children(scheme, tree_class, element) -Return the array of leaf elements of a local tree in a forest. +Compute the number of children of an element when it is refined. # Arguments -* `forest`:\\[in\\] The forest. -* `ltree_id`:\\[in\\] The local id of a local tree of *forest*. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. # Returns -An array of [`t8_element_t`](@ref) * storing all leaf elements of this tree. +The number of children of *element*. ### Prototype ```c -t8_element_array_t * t8_forest_tree_get_leaves (const t8_forest_t forest, const t8_locidx_t ltree_id); +int t8_element_get_num_children (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element); ``` """ -function t8_forest_tree_get_leaves(forest, ltree_id) - @ccall libt8.t8_forest_tree_get_leaves(forest::t8_forest_t, ltree_id::t8_locidx_t)::Ptr{t8_element_array_t} +function t8_element_get_num_children(scheme, tree_class, element) + @ccall libt8.t8_element_get_num_children(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t})::Cint end """ - t8_forest_get_cmesh(forest) + t8_get_max_num_children(scheme, tree_class) -Return a cmesh associated to a forest. +Return the max number of children of an eclass. # Arguments -* `forest`:\\[in\\] The forest. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. # Returns -The cmesh associated to the forest. +The max number of children of *element*. ### Prototype ```c -t8_cmesh_t t8_forest_get_cmesh (t8_forest_t forest); +int t8_get_max_num_children (const t8_scheme_c *scheme, const t8_eclass_t tree_class); ``` """ -function t8_forest_get_cmesh(forest) - @ccall libt8.t8_forest_get_cmesh(forest::t8_forest_t)::t8_cmesh_t +function t8_get_max_num_children(scheme, tree_class) + @ccall libt8.t8_get_max_num_children(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t)::Cint end """ - t8_forest_get_element(forest, lelement_id, ltreeid) - -Return an element of the forest. - -!!! note + t8_element_get_num_face_children(scheme, tree_class, element, face) - This function performs a binary search. For constant access, use t8_forest_get_element_in_tree *forest* must be committed before calling this function. +Compute the number of children of an element's face when the element is refined. # Arguments -* `forest`:\\[in\\] The forest. -* `lelement_id`:\\[in\\] The local id of an element in *forest*. -* `ltreeid`:\\[out\\] If not NULL, on output the local tree id of the tree in which the element lies in. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. +* `face`:\\[in\\] A face of *element*. # Returns -A pointer to the element. NULL if this element does not exist. +The number of children of *face* if *element* is to be refined. ### Prototype ```c -t8_element_t * t8_forest_get_element (t8_forest_t forest, t8_locidx_t lelement_id, t8_locidx_t *ltreeid); +int t8_element_get_num_face_children (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, const int face); ``` """ -function t8_forest_get_element(forest, lelement_id, ltreeid) - @ccall libt8.t8_forest_get_element(forest::t8_forest_t, lelement_id::t8_locidx_t, ltreeid::Ptr{t8_locidx_t})::Ptr{t8_element_t} +function t8_element_get_num_face_children(scheme, tree_class, element, face) + @ccall libt8.t8_element_get_num_face_children(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, face::Cint)::Cint end """ - t8_forest_get_element_in_tree(forest, ltreeid, leid_in_tree) + t8_element_get_face_corner(scheme, tree_class, element, face, corner) -Return an element of a local tree in a forest. - -!!! note +Return the corner number of an element's face corner. Example quad: 2 x --- x 3 | | | | face 1 0 x --- x 1 Thus for face = 1 the output is: corner=0 : 1, corner=1: 3 - If the tree id is know, this function should be preferred over t8_forest_get_element. *forest* must be committed before calling this function. +The order in which the corners must be given is determined by the eclass of *element*: LINE/QUAD/TRIANGLE: No specific order. HEX : In Z-order of the face starting with the lowest corner number. TET : Starting with the lowest corner number counterclockwise as seen from 'outside' of the element. # Arguments -* `forest`:\\[in\\] The forest. -* `ltreeid`:\\[in\\] An id of a local tree in the forest. -* `leid_in_tree`:\\[in\\] The index of an element in the tree. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. +* `face`:\\[in\\] A face index for *element*. +* `corner`:\\[in\\] A corner index for the face 0 <= *corner* < num\\_face\\_corners. # Returns -A pointer to the element. +The corner number of the *corner*-th vertex of *face*. ### Prototype ```c -const t8_element_t * t8_forest_get_element_in_tree (t8_forest_t forest, t8_locidx_t ltreeid, t8_locidx_t leid_in_tree); +int t8_element_get_face_corner (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, const int face, const int corner); ``` """ -function t8_forest_get_element_in_tree(forest, ltreeid, leid_in_tree) - @ccall libt8.t8_forest_get_element_in_tree(forest::t8_forest_t, ltreeid::t8_locidx_t, leid_in_tree::t8_locidx_t)::Ptr{t8_element_t} +function t8_element_get_face_corner(scheme, tree_class, element, face, corner) + @ccall libt8.t8_element_get_face_corner(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, face::Cint, corner::Cint)::Cint end """ - t8_forest_get_tree_num_elements(forest, ltreeid) + t8_element_get_corner_face(scheme, tree_class, element, corner, face) -Return the number of elements of a tree. +Compute the face numbers of the faces sharing an element's corner. Example quad: 2 x --- x 3 | | | | face 1 0 x --- x 1 face 2 Thus for corner = 1 the output is: face=0 : 2, face=1: 1 # Arguments -* `forest`:\\[in\\] The forest. -* `ltreeid`:\\[in\\] A local id of a tree. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. +* `corner`:\\[in\\] A corner index for the face. +* `face`:\\[in\\] A face index for *corner*. # Returns -The number of elements in the local tree *ltreeid*. +The face number of the *face*-th face at *corner*. ### Prototype ```c -t8_locidx_t t8_forest_get_tree_num_elements (t8_forest_t forest, t8_locidx_t ltreeid); +int t8_element_get_corner_face (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, const int corner, const int face); ``` """ -function t8_forest_get_tree_num_elements(forest, ltreeid) - @ccall libt8.t8_forest_get_tree_num_elements(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_locidx_t +function t8_element_get_corner_face(scheme, tree_class, element, corner, face) + @ccall libt8.t8_element_get_corner_face(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, corner::Cint, face::Cint)::Cint end """ - t8_forest_get_tree_element_offset(forest, ltreeid) - -Return the element offset of a local tree, that is the number of elements in all trees with smaller local treeid. - -!!! note + t8_element_get_child(scheme, tree_class, element, childid, child) - *forest* must be committed before calling this function. +Construct the child element of a given number. # Arguments -* `forest`:\\[in\\] The forest. -* `ltreeid`:\\[in\\] A local id of a tree. -# Returns -The number of leaf elements on all local tree with id < *ltreeid*. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] This must be a valid element, bigger than maxlevel. +* `childid`:\\[in\\] The number of the child to construct. +* `child`:\\[in,out\\] The storage for this element must exist. On output, a valid element. It is valid to call this function with element = child. ### Prototype ```c -t8_locidx_t t8_forest_get_tree_element_offset (const t8_forest_t forest, const t8_locidx_t ltreeid); +void t8_element_get_child (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, const int childid, t8_element_t *child); ``` """ -function t8_forest_get_tree_element_offset(forest, ltreeid) - @ccall libt8.t8_forest_get_tree_element_offset(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_locidx_t +function t8_element_get_child(scheme, tree_class, element, childid, child) + @ccall libt8.t8_element_get_child(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, childid::Cint, child::Ptr{t8_element_t})::Cvoid end """ - t8_forest_get_tree_element_count(tree) + t8_element_get_children(scheme, tree_class, element, length, c) -Return the number of elements of a tree. +Construct all children of a given element. # Arguments -* `tree`:\\[in\\] A tree in a forest. -# Returns -The number of elements of that tree. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] This must be a valid element, bigger than maxlevel. +* `length`:\\[in\\] The length of the output array *c* must match the number of children. +* `c`:\\[in,out\\] The storage for these *length* elements must exist and match the element class in the children's ordering. On output, all children are valid. It is valid to call this function with element = c[0]. +# See also +t8\\_element\\_num\\_children + ### Prototype ```c -t8_locidx_t t8_forest_get_tree_element_count (t8_tree_t tree); +void t8_element_get_children (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, const int length, t8_element_t *c[]); ``` """ -function t8_forest_get_tree_element_count(tree) - @ccall libt8.t8_forest_get_tree_element_count(tree::t8_tree_t)::t8_locidx_t +function t8_element_get_children(scheme, tree_class, element, length, c) + @ccall libt8.t8_element_get_children(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, length::Cint, c::Ptr{Ptr{t8_element_t}})::Cvoid end """ - t8_forest_get_tree_class(forest, ltreeid) + t8_element_get_child_id(scheme, tree_class, element) -Return the eclass of a tree in a forest. +Compute the child id of an element. # Arguments -* `forest`:\\[in\\] The forest. -* `ltreeid`:\\[in\\] The local id of a tree (local or ghost) in *forest*. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] This must be a valid element. # Returns -The element class of the tree with local id *ltreeid*. +The child id of element. ### Prototype ```c -t8_eclass_t t8_forest_get_tree_class (const t8_forest_t forest, const t8_locidx_t ltreeid); +int t8_element_get_child_id (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element); ``` """ -function t8_forest_get_tree_class(forest, ltreeid) - @ccall libt8.t8_forest_get_tree_class(forest::t8_forest_t, ltreeid::t8_locidx_t)::t8_eclass_t +function t8_element_get_child_id(scheme, tree_class, element) + @ccall libt8.t8_element_get_child_id(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t})::Cint end """ - t8_forest_get_first_local_element_id(forest) + t8_element_get_ancestor_id(scheme, tree_class, element, level) -Compute the global index of the first local element of a forest. This function is collective. +Compute the ancestor id of an element, that is the child id at a given level. # Arguments -* `forest`:\\[in\\] A committed forest, whose first element's index is computed. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] This must be a valid element. +* `level`:\\[in\\] A refinement level. Must satisfy *level* < element.level # Returns -The global index of *forest*'s first local element. Forest must be committed when calling this function. This function is collective and must be called on each process. +The child\\_id of *element* in regard to its *level* ancestor. ### Prototype ```c -t8_gloidx_t t8_forest_get_first_local_element_id (t8_forest_t forest); +int t8_element_get_ancestor_id (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, const int level); ``` """ -function t8_forest_get_first_local_element_id(forest) - @ccall libt8.t8_forest_get_first_local_element_id(forest::t8_forest_t)::t8_gloidx_t +function t8_element_get_ancestor_id(scheme, tree_class, element, level) + @ccall libt8.t8_element_get_ancestor_id(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, level::Cint)::Cint end """ - t8_forest_get_scheme(forest) + t8_elements_are_family(scheme, tree_class, fam) -Return the element scheme associated to a forest. +Query whether a given set of elements is a family or not. # Arguments -* `forest.`:\\[in\\] A committed forest. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `fam`:\\[in\\] An array of as many elements as an element of class **scheme** has children. # Returns -The element scheme of the forest. -# See also -[`t8_forest_set_scheme`](@ref) - +Zero if **fam** is not a family, nonzero if it is. ### Prototype ```c -t8_scheme_cxx_t * t8_forest_get_scheme (const t8_forest_t forest); +int t8_elements_are_family (const t8_scheme_c *scheme, const t8_eclass_t tree_class, t8_element_t *const *fam); ``` """ -function t8_forest_get_scheme(forest) - @ccall libt8.t8_forest_get_scheme(forest::t8_forest_t)::Ptr{t8_scheme_cxx_t} +function t8_elements_are_family(scheme, tree_class, fam) + @ccall libt8.t8_elements_are_family(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, fam::Ptr{Ptr{t8_element_t}})::Cint end """ - t8_forest_get_eclass_scheme(forest, eclass) - -Return the eclass scheme of a given element class associated to a forest. + t8_element_get_nca(scheme, tree_class, elem1, elem2, nca) -!!! note - - The forest is not required to have trees of class *eclass*. +Compute the nearest common ancestor of two elements. That is, the element with highest level that still has both given elements as descendants. # Arguments -* `forest.`:\\[in\\] A committed forest. -* `eclass.`:\\[in\\] An element class. -# Returns -The eclass scheme of *eclass* associated to forest. -# See also -[`t8_forest_set_scheme`](@ref) - +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `elem1`:\\[in\\] The first of the two input elements. +* `elem2`:\\[in\\] The second of the two input elements. +* `nca`:\\[in,out\\] The storage for this element must exist and match the element class of the child. On output the unique nearest common ancestor of **elem1** and **elem2**. ### Prototype ```c -t8_eclass_scheme_c * t8_forest_get_eclass_scheme (t8_forest_t forest, t8_eclass_t eclass); +void t8_element_get_nca (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *elem1, const t8_element_t *elem2, t8_element_t *nca); ``` """ -function t8_forest_get_eclass_scheme(forest, eclass) - @ccall libt8.t8_forest_get_eclass_scheme(forest::t8_forest_t, eclass::t8_eclass_t)::Ptr{t8_eclass_scheme_c} +function t8_element_get_nca(scheme, tree_class, elem1, elem2, nca) + @ccall libt8.t8_element_get_nca(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, elem1::Ptr{t8_element_t}, elem2::Ptr{t8_element_t}, nca::Ptr{t8_element_t})::Cvoid end """ - t8_forest_element_neighbor_eclass(forest, ltreeid, elem, face) + t8_element_get_face_shape(scheme, tree_class, element, face) -Return the eclass of the tree in which a face neighbor of a given element lies. +Compute the shape of the face of an element. # Arguments -* `forest.`:\\[in\\] A committed forest. -* `ltreeid.`:\\[in\\] The local tree in which the element lies. -* `elem.`:\\[in\\] An element in the tree *ltreeid*. -* `face.`:\\[in\\] A face number of *elem*. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. +* `face`:\\[in\\] A face of *element*. # Returns -The local tree id of the tree in which the face neighbor of *elem* across *face* lies. +The element shape of the face. I.e. T8\\_ECLASS\\_LINE for quads, T8\\_ECLASS\\_TRIANGLE for tets and depending on the face number either T8\\_ECLASS\\_QUAD or T8\\_ECLASS\\_TRIANGLE for prisms. ### Prototype ```c -t8_eclass_t t8_forest_element_neighbor_eclass (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem, int face); +t8_element_shape_t t8_element_get_face_shape (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, const int face); ``` """ -function t8_forest_element_neighbor_eclass(forest, ltreeid, elem, face) - @ccall libt8.t8_forest_element_neighbor_eclass(forest::t8_forest_t, ltreeid::t8_locidx_t, elem::Ptr{t8_element_t}, face::Cint)::t8_eclass_t +function t8_element_get_face_shape(scheme, tree_class, element, face) + @ccall libt8.t8_element_get_face_shape(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, face::Cint)::t8_element_shape_t end """ - t8_forest_element_face_neighbor(forest, ltreeid, elem, neigh, neigh_scheme, face, neigh_face) + t8_element_get_children_at_face(scheme, tree_class, element, face, children, num_children, child_indices) -Construct the face neighbor of an element, possibly across tree boundaries. Returns the global tree-id of the tree in which the neighbor element lies in. +Given an element and a face of the element, compute all children of the element that touch the face. # Arguments -* `elem`:\\[in\\] The element to be considered. -* `neigh`:\\[in,out\\] On input an allocated element of the scheme of the face\\_neighbors eclass. On output, this element's data is filled with the data of the face neighbor. If the neighbor does not exist the data could be modified arbitrarily. -* `neigh_scheme`:\\[in\\] The eclass scheme of *neigh*. -* `face`:\\[in\\] The number of the face along which the neighbor should be constructed. -* `neigh_face`:\\[out\\] The number of the face viewed from perspective of *neigh*. -# Returns -The global tree-id of the tree in which *neigh* is in. -1 if there exists no neighbor across that face. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. +* `face`:\\[in\\] A face of *element*. +* `children`:\\[in,out\\] Allocated elements, in which the children of *element* that share a face with *face* are stored. They will be stored in order of their linear id. +* `num_children`:\\[in\\] The number of elements in *children*. Must match the number of children that touch *face*. t8_scheme::element_get_num_face_children +* `child_indices`:\\[in,out\\] If not NULL, an array of num\\_children integers must be given, on output its i-th entry is the child\\_id of the i-th face\\_child. It is valid to call this function with element = children[0]. ### Prototype ```c -t8_gloidx_t t8_forest_element_face_neighbor (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem, t8_element_t *neigh, t8_eclass_scheme_c *neigh_scheme, int face, int *neigh_face); +void t8_element_get_children_at_face (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, const int face, t8_element_t *children[], const int num_children, int *child_indices); ``` """ -function t8_forest_element_face_neighbor(forest, ltreeid, elem, neigh, neigh_scheme, face, neigh_face) - @ccall libt8.t8_forest_element_face_neighbor(forest::t8_forest_t, ltreeid::t8_locidx_t, elem::Ptr{t8_element_t}, neigh::Ptr{t8_element_t}, neigh_scheme::Ptr{t8_eclass_scheme_c}, face::Cint, neigh_face::Ptr{Cint})::t8_gloidx_t +function t8_element_get_children_at_face(scheme, tree_class, element, face, children, num_children, child_indices) + @ccall libt8.t8_element_get_children_at_face(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, face::Cint, children::Ptr{Ptr{t8_element_t}}, num_children::Cint, child_indices::Ptr{Cint})::Cvoid end """ - t8_forest_iterate(forest) + t8_element_face_get_child_face(scheme, tree_class, element, face, face_child) + +Given a face of an element and a child number of a child of that face, return the face number of the child of the element that matches the child face. + +```c++ + x ---- x x x x ---- x + | | | | | | | <-- f + | | | x | x--x + | | | | | + x ---- x x x ---- x + element face face_child Returns the face number f +``` +# Arguments +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. +* `face`:\\[in\\] Then number of the face. +* `face_child`:\\[in\\] A number 0 <= *face_child* < num\\_face\\_children, specifying a child of *element* that shares a face with *face*. These children are counted in linear order. This coincides with the order of children from a call to t8_scheme::element_get_children_at_face. +# Returns +The face number of the face of a child of *element* that coincides with *face_child*. ### Prototype ```c -void t8_forest_iterate (t8_forest_t forest); +int t8_element_face_get_child_face (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, const int face, const int face_child); ``` """ -function t8_forest_iterate(forest) - @ccall libt8.t8_forest_iterate(forest::t8_forest_t)::Cvoid +function t8_element_face_get_child_face(scheme, tree_class, element, face, face_child) + @ccall libt8.t8_element_face_get_child_face(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, face::Cint, face_child::Cint)::Cint end """ - t8_forest_element_points_inside(forest, ltreeid, element, points, num_points, is_inside, tolerance) + t8_element_face_get_parent_face(scheme, tree_class, element, face) -Query whether a batch of points lies inside an element. For bilinearly interpolated elements. +Given a face of an element return the face number of the parent of the element that matches the element's face. Or return -1 if no face of the parent matches the face. !!! note - For 2D quadrilateral elements this function is only an approximation. It is correct if the four vertices lie in the same plane, but it may produce only approximate results if the vertices do not lie in the same plane. + For the root element this function always returns *face*. # Arguments -* `forest`:\\[in\\] The forest. -* `ltree_id`:\\[in\\] The forest local id of the tree in which the element is. +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. * `element`:\\[in\\] The element. -* `points`:\\[in\\] 3-dimensional coordinates of the points to check -* `num_points`:\\[in\\] The number of points to check -* `is_inside`:\\[in,out\\] An array of length *num_points*, filled with 0/1 on output. True (non-zero) if a *point* lies within an *element*, false otherwise. The return value is also true if the point lies on the element boundary. Thus, this function may return true for different leaf elements, if they are neighbors and the point lies on the common boundary. -* `tolerance`:\\[in\\] Tolerance that we allow the point to not exactly match the element. If this value is larger we detect more points. If it is zero we probably do not detect points even if they are inside due to rounding errors. +* `face`:\\[in\\] Then number of the face. +# Returns +If *face* of *element* is also a face of *element*'s parent, the face number of this face. Otherwise -1. ### Prototype ```c -void t8_forest_element_points_inside (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *points, int num_points, int *is_inside, const double tolerance); +int t8_element_face_get_parent_face (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, const int face); ``` """ -function t8_forest_element_points_inside(forest, ltreeid, element, points, num_points, is_inside, tolerance) - @ccall libt8.t8_forest_element_points_inside(forest::t8_forest_t, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, points::Ptr{Cdouble}, num_points::Cint, is_inside::Ptr{Cint}, tolerance::Cdouble)::Cvoid +function t8_element_face_get_parent_face(scheme, tree_class, element, face) + @ccall libt8.t8_element_face_get_parent_face(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, face::Cint)::Cint end """ - t8_forest_new_uniform(cmesh, scheme, level, do_face_ghost, comm) + t8_element_get_tree_face(scheme, tree_class, element, face) + +Given an element and a face of this element. If the face lies on the tree boundary, return the face number of the tree face. If not the return value is arbitrary. +# Arguments +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in\\] The element. +* `face`:\\[in\\] The index of a face of *element*. +# Returns +The index of the tree face that *face* is a subface of, if *face* is on a tree boundary. Any arbitrary integer if *is* not at a tree boundary. ### Prototype ```c -t8_forest_t t8_forest_new_uniform (t8_cmesh_t cmesh, t8_scheme_cxx_t *scheme, const int level, const int do_face_ghost, sc_MPI_Comm comm); +int t8_element_get_tree_face (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *element, const int face); ``` """ -function t8_forest_new_uniform(cmesh, scheme, level, do_face_ghost, comm) - @ccall libt8.t8_forest_new_uniform(cmesh::t8_cmesh_t, scheme::Ptr{t8_scheme_cxx_t}, level::Cint, do_face_ghost::Cint, comm::MPI_Comm)::t8_forest_t +function t8_element_get_tree_face(scheme, tree_class, element, face) + @ccall libt8.t8_element_get_tree_face(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t}, face::Cint)::Cint end """ - t8_forest_new_adapt(forest_from, adapt_fn, recursive, do_face_ghost, user_data) + t8_element_transform_face(scheme, tree_class, elem1, elem2, orientation, sign, is_smaller_face) -Build a adapted forest from another forest. +Suppose we have two trees that share a common face f. Given an element e that is a subface of f in one of the trees and given the orientation of the tree connection, construct the face element of the respective tree neighbor that logically coincides with e but lies in the coordinate system of the neighbor tree. !!! note - This is equivalent to calling t8_forest_init, t8_forest_set_adapt, t8_forest_set_ghost, and t8_forest_commit + *elem1* and *elem2* may point to the same element. + +# Arguments +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `elem1`:\\[in\\] The face element. +* `elem2`:\\[in,out\\] On return the face element *elem1* with respect to the coordinate system of the other tree. +* `orientation`:\\[in\\] The orientation of the tree-tree connection. +* `sign`:\\[in\\] Depending on the topological orientation of the two tree faces, either 0 (both faces have opposite orientation) or 1 (both faces have the same top. orientation). t8_eclass_face_orientation +* `is_smaller_face`:\\[in\\] Flag to declare whether *elem1* belongs to the smaller face. A face f of tree T is smaller than f' of T' if either the eclass of T is smaller or if the classes are equal and fghost\\_trees array of the tree. Otherwise a negative number. *forest* must be committed before calling this function. -# See also -https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. - +* `scheme`:\\[in\\] The scheme of the forest. +* `tree_class`:\\[in\\] The eclass of tree the elements are part of. +* `element`:\\[in,out\\] The element to be filled with root. ### Prototype ```c -t8_locidx_t t8_forest_ghost_get_ghost_treeid (t8_forest_t forest, t8_gloidx_t gtreeid); +void t8_element_set_to_root (const t8_scheme_c *scheme, const t8_eclass_t tree_class, t8_element_t *element); ``` """ -function t8_forest_ghost_get_ghost_treeid(forest, gtreeid) - @ccall libt8.t8_forest_ghost_get_ghost_treeid(forest::t8_forest_t, gtreeid::t8_gloidx_t)::t8_locidx_t +function t8_element_set_to_root(scheme, tree_class, element) + @ccall libt8.t8_element_set_to_root(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, element::Ptr{t8_element_t})::Cvoid end """ - t8_forest_ghost_get_tree_class(forest, lghost_tree) + t8_element_MPI_Pack(scheme, tree_class, elements, count, send_buffer, buffer_size, position, comm) ### Prototype ```c -t8_eclass_t t8_forest_ghost_get_tree_class (const t8_forest_t forest, const t8_locidx_t lghost_tree); +void t8_element_MPI_Pack (const t8_scheme_c *scheme, const t8_eclass_t tree_class, t8_element_t **const elements, const unsigned int count, void *send_buffer, const int buffer_size, int *position, sc_MPI_Comm comm); ``` """ -function t8_forest_ghost_get_tree_class(forest, lghost_tree) - @ccall libt8.t8_forest_ghost_get_tree_class(forest::t8_forest_t, lghost_tree::t8_locidx_t)::t8_eclass_t +function t8_element_MPI_Pack(scheme, tree_class, elements, count, send_buffer, buffer_size, position, comm) + @ccall libt8.t8_element_MPI_Pack(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, elements::Ptr{Ptr{t8_element_t}}, count::Cuint, send_buffer::Ptr{Cvoid}, buffer_size::Cint, position::Ptr{Cint}, comm::Cint)::Cvoid end """ - t8_forest_ghost_get_global_treeid(forest, lghost_tree) - -Given a local ghost tree compute the global tree id of it. - -# Arguments -* `forest`:\\[in\\] The forest. Ghost layer must exist. -* `lghost_tree`:\\[in\\] The ghost tree id of a ghost tree. -# Returns -The global id of the local ghost tree *lghost_tree*. *forest* must be committed before calling this function. -# See also -https://github.com/DLR-AMR/t8code/wiki/Tree-indexing for more details about tree indexing. + t8_element_MPI_Pack_size(scheme, tree_class, count, comm, pack_size) ### Prototype ```c -t8_gloidx_t t8_forest_ghost_get_global_treeid (const t8_forest_t forest, const t8_locidx_t lghost_tree); +void t8_element_MPI_Pack_size (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const unsigned int count, sc_MPI_Comm comm, int *pack_size); ``` """ -function t8_forest_ghost_get_global_treeid(forest, lghost_tree) - @ccall libt8.t8_forest_ghost_get_global_treeid(forest::t8_forest_t, lghost_tree::t8_locidx_t)::t8_gloidx_t +function t8_element_MPI_Pack_size(scheme, tree_class, count, comm, pack_size) + @ccall libt8.t8_element_MPI_Pack_size(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, count::Cuint, comm::Cint, pack_size::Ptr{Cint})::Cvoid end """ - t8_forest_ghost_get_element(forest, lghost_tree, lelement) + t8_element_MPI_Unpack(scheme, tree_class, recvbuf, buffer_size, position, elements, count, comm) ### Prototype ```c -t8_element_t * t8_forest_ghost_get_element (t8_forest_t forest, t8_locidx_t lghost_tree, t8_locidx_t lelement); +void t8_element_MPI_Unpack (const t8_scheme_c *scheme, const t8_eclass_t tree_class, void *recvbuf, const int buffer_size, int *position, t8_element_t **elements, const unsigned int count, sc_MPI_Comm comm); ``` """ -function t8_forest_ghost_get_element(forest, lghost_tree, lelement) - @ccall libt8.t8_forest_ghost_get_element(forest::t8_forest_t, lghost_tree::t8_locidx_t, lelement::t8_locidx_t)::Ptr{t8_element_t} +function t8_element_MPI_Unpack(scheme, tree_class, recvbuf, buffer_size, position, elements, count, comm) + @ccall libt8.t8_element_MPI_Unpack(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, recvbuf::Ptr{Cvoid}, buffer_size::Cint, position::Ptr{Cint}, elements::Ptr{Ptr{t8_element_t}}, count::Cuint, comm::Cint)::Cvoid end """ - t8_forest_ghost_get_remotes(forest, num_remotes) + vtk_file_type -Return the array of remote ranks. +Enumerator for all types of files readable by t8code. +""" +@cenum vtk_file_type::Int32 begin + VTK_FILE_ERROR = -1 + VTK_SERIAL_FILE = 8 + VTK_UNSTRUCTURED_FILE = 8 + VTK_POLYDATA_FILE = 9 + VTK_PARALLEL_FILE = 16 + VTK_PARALLEL_UNSTRUCTURED_FILE = 16 + VTK_PARALLEL_POLYDATA_FILE = 17 + VTK_NUM_TYPES = 5 +end + +"""Enumerator for all types of files readable by t8code.""" +const vtk_file_type_t = vtk_file_type -# Arguments -* `forest`:\\[in\\] A forest with constructed ghost layer. -* `num_remotes`:\\[in,out\\] On output the number of remote ranks is stored here. -# Returns -The array of remote ranks in ascending order. -### Prototype -```c -int * t8_forest_ghost_get_remotes (t8_forest_t forest, int *num_remotes); -``` """ -function t8_forest_ghost_get_remotes(forest, num_remotes) - @ccall libt8.t8_forest_ghost_get_remotes(forest::t8_forest_t, num_remotes::Ptr{Cint})::Ptr{Cint} + vtk_read_success + +Enumerator for the success of reading a vtk file. This is used to indicate whether the reading was successful or not. +""" +@cenum vtk_read_success::UInt32 begin + read_failure = 0 + read_success = 1 end +"""Enumerator for the success of reading a vtk file. This is used to indicate whether the reading was successful or not.""" +const vtk_read_success_t = vtk_read_success + """ - t8_forest_ghost_remote_first_tree(forest, remote) + t8_forest_vtk_write_file_via_API(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, curved_flag, write_ghosts, num_data, data) -Return the first local ghost tree of a remote rank. +Write the forest in .pvtu file format. Writes one .vtu file per process and a meta .pvtu file. This function uses the vtk library. t8code must be configured with "--enable-vtk" in order to use it. Currently does not support pyramid elements. + +!!! note + + If t8code was not configured with vtk, use t8_forest_vtk_write_file # Arguments -* `forest`:\\[in\\] A forest with constructed ghost layer. -* `remote`:\\[in\\] A remote rank of the ghost layer in *forest*. +* `forest`:\\[in\\] The forest. +* `fileprefix`:\\[in\\] The prefix of the output files. The meta file will be named *fileprefix*.pvtu . +* `write_treeid`:\\[in\\] If true, the global tree id is written for each element. +* `write_mpirank`:\\[in\\] If true, the mpirank is written for each element. +* `write_level`:\\[in\\] If true, the refinement level is written for each element. +* `write_element_id`:\\[in\\] If true, the global element id is written for each element. +* `curved_flag`:\\[in\\] If true, write the elements as curved element types from vtk. +* `write_ghosts`:\\[in\\] If true, write out ghost elements as well. +* `num_data`:\\[in\\] Number of user defined double valued data fields to write. +* `data`:\\[in\\] Array of [`t8_vtk_data_field_t`](@ref) of length *num_data* providing the user defined per element data. If scalar and vector fields are used, all scalar fields must come first in the array. # Returns -The ghost tree id of the first ghost tree that stores ghost elements of *remote*. +True if successful, false if not (process local). ### Prototype ```c -t8_locidx_t t8_forest_ghost_remote_first_tree (t8_forest_t forest, int remote); +int t8_forest_vtk_write_file_via_API (t8_forest_t forest, const char *fileprefix, const int write_treeid, const int write_mpirank, const int write_level, const int write_element_id, const int curved_flag, const int write_ghosts, const int num_data, t8_vtk_data_field_t *data); ``` """ -function t8_forest_ghost_remote_first_tree(forest, remote) - @ccall libt8.t8_forest_ghost_remote_first_tree(forest::t8_forest_t, remote::Cint)::t8_locidx_t +function t8_forest_vtk_write_file_via_API(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, curved_flag, write_ghosts, num_data, data) + @ccall libt8.t8_forest_vtk_write_file_via_API(forest::t8_forest_t, fileprefix::Cstring, write_treeid::Cint, write_mpirank::Cint, write_level::Cint, write_element_id::Cint, curved_flag::Cint, write_ghosts::Cint, num_data::Cint, data::Ptr{t8_vtk_data_field_t})::Cint end """ - t8_forest_ghost_remote_first_elem(forest, remote) + t8_forest_vtk_write_file(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, write_ghosts, num_data, data) -Return the local index of the first ghost element that belongs to a given remote rank. +Write the forest in .pvtu file format. Writes one .vtu file per process and a meta .pvtu file. This function writes ASCII files and can be used when t8code is not configure with "--enable-vtk" and t8_forest_vtk_write_file_via_API is not available. # Arguments -* `forest`:\\[in\\] A forest with constructed ghost layer. -* `remote`:\\[in\\] A remote rank of the ghost layer in *forest*. +* `forest`:\\[in\\] The forest. +* `fileprefix`:\\[in\\] The prefix of the output files. +* `write_treeid`:\\[in\\] If true, the global tree id is written for each element. +* `write_mpirank`:\\[in\\] If true, the mpirank is written for each element. +* `write_level`:\\[in\\] If true, the refinement level is written for each element. +* `write_element_id`:\\[in\\] If true, the global element id is written for each element. +* `write_ghosts`:\\[in\\] If true, each process additionally writes its ghost elements. For ghost element the treeid is -1. +* `num_data`:\\[in\\] Number of user defined double valued data fields to write. +* `data`:\\[in\\] Array of [`t8_vtk_data_field_t`](@ref) of length *num_data* providing the used defined per element data. If scalar and vector fields are used, all scalar fields must come first in the array. # Returns -The index i in the ghost elements of the first element of rank *remote* +True if successful, false if not (process local). ### Prototype ```c -t8_locidx_t t8_forest_ghost_remote_first_elem (t8_forest_t forest, int remote); +int t8_forest_vtk_write_file (t8_forest_t forest, const char *fileprefix, const int write_treeid, const int write_mpirank, const int write_level, const int write_element_id, int write_ghosts, const int num_data, t8_vtk_data_field_t *data); ``` """ -function t8_forest_ghost_remote_first_elem(forest, remote) - @ccall libt8.t8_forest_ghost_remote_first_elem(forest::t8_forest_t, remote::Cint)::t8_locidx_t +function t8_forest_vtk_write_file(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, write_ghosts, num_data, data) + @ccall libt8.t8_forest_vtk_write_file(forest::t8_forest_t, fileprefix::Cstring, write_treeid::Cint, write_mpirank::Cint, write_level::Cint, write_element_id::Cint, write_ghosts::Cint, num_data::Cint, data::Ptr{t8_vtk_data_field_t})::Cint end """ - t8_forest_ghost_ref(ghost) - -Increase the reference count of a ghost structure. + t8_cmesh_vtk_write_file_via_API(cmesh, fileprefix, comm) -# Arguments -* `ghost`:\\[in,out\\] On input, this ghost structure must exist with positive reference count. ### Prototype ```c -void t8_forest_ghost_ref (t8_forest_ghost_t ghost); +int t8_cmesh_vtk_write_file_via_API (t8_cmesh_t cmesh, const char *fileprefix, sc_MPI_Comm comm); ``` """ -function t8_forest_ghost_ref(ghost) - @ccall libt8.t8_forest_ghost_ref(ghost::t8_forest_ghost_t)::Cvoid +function t8_cmesh_vtk_write_file_via_API(cmesh, fileprefix, comm) + @ccall libt8.t8_cmesh_vtk_write_file_via_API(cmesh::t8_cmesh_t, fileprefix::Cstring, comm::Cint)::Cint end """ - t8_forest_ghost_unref(pghost) + t8_cmesh_vtk_write_file(cmesh, fileprefix) -Decrease the reference count of a ghost structure. If the counter reaches zero, the ghost structure is destroyed. See also t8_forest_ghost_destroy, which is to be preferred when it is known that the last reference to a cmesh is deleted. +Write the cmesh in .pvtu file format. Writes one .vtu file per process and a meta .pvtu file. This function writes ASCII files and can be used when t8code is not configure with "--enable-vtk" and t8_cmesh_vtk_write_file_via_API is not available. # Arguments -* `pghost`:\\[in,out\\] On input, the ghost structure pointed to must exist with positive reference count. If the reference count reaches zero, the ghost structure is destroyed and this pointer is set to NULL. Otherwise, the pointer is not changed. +* `cmesh`:\\[in\\] The cmesh +* `fileprefix`:\\[in\\] The prefix of the output files +# Returns +int ### Prototype ```c -void t8_forest_ghost_unref (t8_forest_ghost_t *pghost); +int t8_cmesh_vtk_write_file (t8_cmesh_t cmesh, const char *fileprefix); ``` """ -function t8_forest_ghost_unref(pghost) - @ccall libt8.t8_forest_ghost_unref(pghost::Ptr{t8_forest_ghost_t})::Cvoid +function t8_cmesh_vtk_write_file(cmesh, fileprefix) + @ccall libt8.t8_cmesh_vtk_write_file(cmesh::t8_cmesh_t, fileprefix::Cstring)::Cint end """ - t8_forest_ghost_destroy(pghost) - -Verify that a ghost structure has only one reference left and destroy it. This function is preferred over t8_ghost_unref when it is known that the last reference is to be deleted. + t8_cmesh_from_msh_file(fileprefix, partition, comm, dim, master, use_cad_geometry) -# Arguments -* `pghost`:\\[in,out\\] This ghost structure must have a reference count of one. It can be in any state (committed or not). Then it effectively calls t8_forest_ghost_unref. ### Prototype ```c -void t8_forest_ghost_destroy (t8_forest_ghost_t *pghost); +t8_cmesh_t t8_cmesh_from_msh_file (const char *fileprefix, int partition, sc_MPI_Comm comm, int dim, int master, int use_cad_geometry); ``` """ -function t8_forest_ghost_destroy(pghost) - @ccall libt8.t8_forest_ghost_destroy(pghost::Ptr{t8_forest_ghost_t})::Cvoid +function t8_cmesh_from_msh_file(fileprefix, partition, comm, dim, master, use_cad_geometry) + @ccall libt8.t8_cmesh_from_msh_file(fileprefix::Cstring, partition::Cint, comm::Cint, dim::Cint, master::Cint, use_cad_geometry::Cint)::t8_cmesh_t +end + +struct sc_flopinfo + seconds::Cdouble + cwtime::Cdouble + crtime::Cfloat + cptime::Cfloat + cflpops::Clonglong + iwtime::Cdouble + irtime::Cfloat + iptime::Cfloat + iflpops::Clonglong + mflops::Cfloat + use_papi::Cint end +const sc_flopinfo_t = sc_flopinfo + """ - t8_forest_ghost_create(forest) + sc_flops_snap(fi, snapshot) -Create one layer of ghost elements for a forest. +Call [`sc_flops_count`](@ref) (fi) and copies fi into snapshot. # Arguments -* `forest`:\\[in,out\\] The forest. *forest* must be committed before calling this function. -# See also -[`t8_forest_set_ghost`](@ref) - +* `fi`:\\[in,out\\] Members will be updated. +* `snapshot`:\\[out\\] On output is a copy of fi. ### Prototype ```c -void t8_forest_ghost_create (t8_forest_t forest); +void sc_flops_snap (sc_flopinfo_t * fi, sc_flopinfo_t * snapshot); ``` """ -function t8_forest_ghost_create(forest) - @ccall libt8.t8_forest_ghost_create(forest::t8_forest_t)::Cvoid +function sc_flops_snap(fi, snapshot) + @ccall libt8.sc_flops_snap(fi::Ptr{sc_flopinfo_t}, snapshot::Ptr{sc_flopinfo_t})::Cvoid end """ - t8_forest_ghost_create_balanced_only(forest) - -Create one layer of ghost elements for a forest. This version only works with balanced forests and is the original algorithm from p4est: Scalable Algorithms For Parallel Adaptive Mesh Refinement On Forests of Octrees - -!!! note + sc_flops_shot(fi, snapshot) - The user should prefer t8_forest_ghost_create even for balanced forests. +Call [`sc_flops_count`](@ref) (fi) and override snapshot interval timings with the differences since the previous call to [`sc_flops_snap`](@ref). The interval mflop rate is computed by iflpops / 1e6 / irtime. The cumulative timings in snapshot are copied form fi. # Arguments -* `forest`:\\[in,out\\] The balanced forest/ *forest* must be committed before calling this function. +* `fi`:\\[in,out\\] Members will be updated. +* `snapshot`:\\[in,out\\] Interval timings measured since [`sc_flops_snap`](@ref). ### Prototype ```c -void t8_forest_ghost_create_balanced_only (t8_forest_t forest); +void sc_flops_shot (sc_flopinfo_t * fi, sc_flopinfo_t * snapshot); ``` """ -function t8_forest_ghost_create_balanced_only(forest) - @ccall libt8.t8_forest_ghost_create_balanced_only(forest::t8_forest_t)::Cvoid +function sc_flops_shot(fi, snapshot) + @ccall libt8.sc_flops_shot(fi::Ptr{sc_flopinfo_t}, snapshot::Ptr{sc_flopinfo_t})::Cvoid end """ - t8_forest_ghost_create_topdown(forest) + sc_flops_papi(rtime, ptime, flpops, mflops) + +Calls PAPI\\_flops. Aborts on PAPI error. The first call sets up the performance counters. Subsequent calls return cumulative real and process times, cumulative floating point operations and the flop rate since the last call. This is a compatibility wrapper: users should only need to use the [`sc_flopinfo_t`](@ref) interface functions below. ### Prototype ```c -void t8_forest_ghost_create_topdown (t8_forest_t forest); +void sc_flops_papi (float *rtime, float *ptime, long long *flpops, float *mflops); ``` """ -function t8_forest_ghost_create_topdown(forest) - @ccall libt8.t8_forest_ghost_create_topdown(forest::t8_forest_t)::Cvoid +function sc_flops_papi(rtime, ptime, flpops, mflops) + @ccall libt8.sc_flops_papi(rtime::Ptr{Cfloat}, ptime::Ptr{Cfloat}, flpops::Ptr{Clonglong}, mflops::Ptr{Cfloat})::Cvoid end """ - t8_forest_save(forest) + sc_flops_start(fi) + +Prepare [`sc_flopinfo_t`](@ref) structure and start flop counters. Must only be called once during the program run. This function calls [`sc_flops_papi`](@ref). +# Arguments +* `fi`:\\[out\\] Members will be initialized. ### Prototype ```c -void t8_forest_save (t8_forest_t forest); +void sc_flops_start (sc_flopinfo_t * fi); ``` """ -function t8_forest_save(forest) - @ccall libt8.t8_forest_save(forest::t8_forest_t)::Cvoid +function sc_flops_start(fi) + @ccall libt8.sc_flops_start(fi::Ptr{sc_flopinfo_t})::Cvoid end """ - t8_forest_write_vtk_ext(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, write_ghosts, write_curved, do_not_use_API, num_data, data) + sc_flops_start_nopapi(fi) + +Prepare [`sc_flopinfo_t`](@ref) structure and ignore the flop counters. This [`sc_flopinfo_t`](@ref) does not call PAPI\\_flops() in this function or in [`sc_flops_count`](@ref)(). +# Arguments +* `fi`:\\[out\\] Members will be initialized. ### Prototype ```c -int t8_forest_write_vtk_ext (t8_forest_t forest, const char *fileprefix, const int write_treeid, const int write_mpirank, const int write_level, const int write_element_id, const int write_ghosts, const int write_curved, int do_not_use_API, const int num_data, t8_vtk_data_field_t *data); +void sc_flops_start_nopapi (sc_flopinfo_t * fi); ``` """ -function t8_forest_write_vtk_ext(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, write_ghosts, write_curved, do_not_use_API, num_data, data) - @ccall libt8.t8_forest_write_vtk_ext(forest::t8_forest_t, fileprefix::Cstring, write_treeid::Cint, write_mpirank::Cint, write_level::Cint, write_element_id::Cint, write_ghosts::Cint, write_curved::Cint, do_not_use_API::Cint, num_data::Cint, data::Ptr{t8_vtk_data_field_t})::Cint +function sc_flops_start_nopapi(fi) + @ccall libt8.sc_flops_start_nopapi(fi::Ptr{sc_flopinfo_t})::Cvoid end """ - t8_forest_write_vtk(forest, fileprefix) + sc_flops_count(fi) + +Update [`sc_flopinfo_t`](@ref) structure with current measurement. Must only be called after [`sc_flops_start`](@ref). Can be called any number of times. This function calls [`sc_flops_papi`](@ref). +# Arguments +* `fi`:\\[in,out\\] Members will be updated. ### Prototype ```c -int t8_forest_write_vtk (t8_forest_t forest, const char *fileprefix); +void sc_flops_count (sc_flopinfo_t * fi); ``` """ -function t8_forest_write_vtk(forest, fileprefix) - @ccall libt8.t8_forest_write_vtk(forest::t8_forest_t, fileprefix::Cstring)::Cint +function sc_flops_count(fi) + @ccall libt8.sc_flops_count(fi::Ptr{sc_flopinfo_t})::Cvoid end -# typedef int ( * t8_forest_iterate_face_fn ) ( t8_forest_t forest , t8_locidx_t ltreeid , const t8_element_t * element , int face , void * user_data , t8_locidx_t tree_leaf_index ) -const t8_forest_iterate_face_fn = Ptr{Cvoid} +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function sc_flops_shotv(fi, va_list...) + :(@ccall(libt8.sc_flops_shotv(fi::Ptr{sc_flopinfo_t}; $(to_c_type_pairs(va_list)...))::Cvoid)) + end -# typedef int ( * t8_forest_search_fn ) ( t8_forest_t forest , const t8_locidx_t ltreeid , const t8_element_t * element , const int is_leaf , const t8_element_array_t * leaf_elements , const t8_locidx_t tree_leaf_index ) +mutable struct sc_options end + +"""The options data structure is opaque.""" +const sc_options_t = sc_options + +# typedef int ( * sc_options_callback_t ) ( sc_options_t * opt , const char * opt_arg , void * data ) """ -A call-back function used by t8_forest_search describing a search-criterion. Is called on an element and the search criterion should be checked on that element. Return true if the search criterion is met, false otherwise. +This callback can be invoked with sc_options_parse. # Arguments -* `forest`:\\[in\\] the forest -* `ltreeid`:\\[in\\] the local tree id of the current tree -* `element`:\\[in\\] the element for which the search criterion is checked. -* `is_leaf`:\\[in\\] true if and only if *element* is a leaf element -* `leaf_elements`:\\[in\\] the leaf elements in *forest* that are descendants of *element* (or the element itself if *is_leaf* is true) -* `tree_leaf_index`:\\[in\\] the local index of the first leaf in *leaf_elements* +* `opt`:\\[in\\] Valid options data structure. This is passed as a matter of principle. +* `opt_arg`:\\[in\\] The option argument or NULL if there is none. This variable is internal. Do not store pointer. +* `data`:\\[in\\] User-defined data passed to [`sc_options_add_callback`](@ref). # Returns -non-zero if the search criterion is met, zero otherwise. +Return 0 if successful, -1 to indicate a parse error. """ -const t8_forest_search_fn = Ptr{Cvoid} +const sc_options_callback_t = Ptr{Cvoid} -# typedef void ( * t8_forest_query_fn ) ( t8_forest_t forest , const t8_locidx_t ltreeid , const t8_element_t * element , const int is_leaf , const t8_element_array_t * leaf_elements , const t8_locidx_t tree_leaf_index , sc_array_t * queries , sc_array_t * query_indices , int * query_matches , const size_t num_active_queries ) """ -A call-back function used by t8_forest_search for queries. Is called on an element and all queries are checked on that element. All positive queries are passed further down to the children of the element up to leaf elements of the tree. The results of the check are stored in *query_matches*. + sc_options_new(program_path) + +Create an empty options structure. # Arguments -* `forest`:\\[in\\] the forest -* `ltreeid`:\\[in\\] the local tree id of the current tree -* `element`:\\[in\\] the element for which the queries are executed -* `is_leaf`:\\[in\\] true if and only if *element* is a leaf element -* `leaf_elements`:\\[in\\] the leaf elements in *forest* that are descendants of *element* (or the element itself if *is_leaf* is true) -* `tree_leaf_index`:\\[in\\] the local index of the first leaf in *leaf_elements* -* `queries`:\\[in\\] An array of queries that are checked by the function -* `query_indices`:\\[in\\] An array of size\\_t entries, where each entry is an index of a query in queries. -* `query_matches`:\\[in,out\\] An array of length *num_active_queries*. If the element is not a leave must be set to true or false at the i-th index for each query, specifying whether the element 'matches' the query of the i-th query index or not. When the element is a leaf we can return before all entries are set. -* `num_active_queries`:\\[in\\] The number of currently active queries (equals the number of entries of *query_matches* and entries of *query_indices*). +* `program_path`:\\[in\\] Name or path name of the program to display. Usually argv[0] is fine. +# Returns +A valid and empty options structure. +### Prototype +```c +sc_options_t *sc_options_new (const char *program_path); +``` """ -const t8_forest_query_fn = Ptr{Cvoid} +function sc_options_new(program_path) + @ccall libt8.sc_options_new(program_path::Cstring)::Ptr{sc_options_t} +end """ - t8_forest_split_array(element, leaf_elements, offsets) + sc_options_destroy_deep(opt) + +Destroy the options structure and all allocated structures contained. The keyvalue structure passed into sc\\_keyvalue\\_add is destroyed. + +!!! compat "Deprecated" + + This function is kept for backwards compatibility. It is best to destroy any key-value container outside of the lifetime of the options object. +# Arguments +* `opt`:\\[in,out\\] This options structure is deallocated, including all key-value containers referenced. ### Prototype ```c -void t8_forest_split_array (const t8_element_t *element, t8_element_array_t *leaf_elements, size_t *offsets); +void sc_options_destroy_deep (sc_options_t * opt); ``` """ -function t8_forest_split_array(element, leaf_elements, offsets) - @ccall libt8.t8_forest_split_array(element::Ptr{t8_element_t}, leaf_elements::Ptr{t8_element_array_t}, offsets::Ptr{Csize_t})::Cvoid +function sc_options_destroy_deep(opt) + @ccall libt8.sc_options_destroy_deep(opt::Ptr{sc_options_t})::Cvoid end """ - t8_forest_iterate_faces(forest, ltreeid, element, face, leaf_elements, user_data, tree_lindex_of_first_leaf, callback) + sc_options_destroy(opt) + +Destroy the options structure. Whatever has been passed into sc\\_keyvalue\\_add is left alone. +# Arguments +* `opt`:\\[in,out\\] This options structure is deallocated. ### Prototype ```c -void t8_forest_iterate_faces (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, int face, t8_element_array_t *leaf_elements, void *user_data, t8_locidx_t tree_lindex_of_first_leaf, t8_forest_iterate_face_fn callback); +void sc_options_destroy (sc_options_t * opt); ``` """ -function t8_forest_iterate_faces(forest, ltreeid, element, face, leaf_elements, user_data, tree_lindex_of_first_leaf, callback) - @ccall libt8.t8_forest_iterate_faces(forest::t8_forest_t, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, face::Cint, leaf_elements::Ptr{t8_element_array_t}, user_data::Ptr{Cvoid}, tree_lindex_of_first_leaf::t8_locidx_t, callback::t8_forest_iterate_face_fn)::Cvoid +function sc_options_destroy(opt) + @ccall libt8.sc_options_destroy(opt::Ptr{sc_options_t})::Cvoid end """ - t8_forest_search(forest, search_fn, query_fn, queries) + sc_options_set_spacing(opt, space_type, space_help) + +Set the spacing for sc_options_print_summary. There are two values to be set: the spacing from the beginning of the printed line to the type of the option variable, and from the beginning of the printed line to the help string. +# Arguments +* `opt`:\\[in,out\\] Valid options structure. +* `space_type`:\\[in\\] Number of spaces to the type display, for example , , etc. Setting this negative sets the default 20. +* `space_help`:\\[in\\] Number of space to the help string. Setting this negative sets the default 32. ### Prototype ```c -void t8_forest_search (t8_forest_t forest, t8_forest_search_fn search_fn, t8_forest_query_fn query_fn, sc_array_t *queries); +void sc_options_set_spacing (sc_options_t * opt, int space_type, int space_help); ``` """ -function t8_forest_search(forest, search_fn, query_fn, queries) - @ccall libt8.t8_forest_search(forest::t8_forest_t, search_fn::t8_forest_search_fn, query_fn::t8_forest_query_fn, queries::Ptr{sc_array_t})::Cvoid +function sc_options_set_spacing(opt, space_type, space_help) + @ccall libt8.sc_options_set_spacing(opt::Ptr{sc_options_t}, space_type::Cint, space_help::Cint)::Cvoid end """ - t8_forest_iterate_replace(forest_new, forest_old, replace_fn) - -Given two forest where the elements in one forest are either direct children or parents of the elements in the other forest compare the two forests and for each refined element or coarsened family in the old one, call a callback function providing the local indices of the old and new elements. - -!!! note + sc_options_add_switch(opt, opt_char, opt_name, variable, help_string) - To pass a user pointer to *replace_fn* use t8_forest_set_user_data and t8_forest_get_user_data. +Add a switch option. This option is used without option arguments. Every use increments the variable by one. Its initial value is 0. Either opt\\_char or opt\\_name must be valid, that is, not '\\0'/NULL. # Arguments -* `forest_new`:\\[in\\] A forest, each element is a parent or child of an element in *forest_old*. -* `forest_old`:\\[in\\] The initial forest. -* `replace_fn`:\\[in\\] A replace callback function. +* `opt`:\\[in,out\\] A valid options structure. +* `opt_char`:\\[in\\] Short option character, may be '\\0'. +* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. +* `variable`:\\[in\\] Address of the variable to store the option value. +* `help_string`:\\[in\\] Help string for usage message, may be NULL. ### Prototype ```c -void t8_forest_iterate_replace (t8_forest_t forest_new, t8_forest_t forest_old, t8_forest_replace_t replace_fn); +void sc_options_add_switch (sc_options_t * opt, int opt_char, const char *opt_name, int *variable, const char *help_string); ``` """ -function t8_forest_iterate_replace(forest_new, forest_old, replace_fn) - @ccall libt8.t8_forest_iterate_replace(forest_new::t8_forest_t, forest_old::t8_forest_t, replace_fn::t8_forest_replace_t)::Cvoid +function sc_options_add_switch(opt, opt_char, opt_name, variable, help_string) + @ccall libt8.sc_options_add_switch(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Cint}, help_string::Cstring)::Cvoid end """ - t8_forest_partition(forest) + sc_options_add_bool(opt, opt_char, opt_name, variable, init_value, help_string) + +Add a boolean option. It can be initialized to true or false in the C sense. Specifying it on the command line without argument sets the option to true. The argument 0/f/F/n/N sets it to false (0). The argument 1/t/T/y/Y sets it to true (nonzero). +# Arguments +* `opt`:\\[in,out\\] A valid options structure. +* `opt_char`:\\[in\\] Short option character, may be '\\0'. +* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. +* `variable`:\\[in\\] Address of the variable to store the option value. +* `init_value`:\\[in\\] Initial value to set the option, read as true or false. +* `help_string`:\\[in\\] Help string for usage message, may be NULL. ### Prototype ```c -void t8_forest_partition (t8_forest_t forest); +void sc_options_add_bool (sc_options_t * opt, int opt_char, const char *opt_name, int *variable, int init_value, const char *help_string); ``` """ -function t8_forest_partition(forest) - @ccall libt8.t8_forest_partition(forest::t8_forest_t)::Cvoid +function sc_options_add_bool(opt, opt_char, opt_name, variable, init_value, help_string) + @ccall libt8.sc_options_add_bool(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Cint}, init_value::Cint, help_string::Cstring)::Cvoid end """ - t8_forest_partition_create_offsets(forest) + sc_options_add_int(opt, opt_char, opt_name, variable, init_value, help_string) -Create the element\\_offset array of a partitioned forest. +Add an option that takes an integer argument. # Arguments -* `forest`:\\[in,out\\] The forest. *forest* must be committed before calling this function. +* `opt`:\\[in,out\\] A valid options structure. +* `opt_char`:\\[in\\] Short option character, may be '\\0'. +* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. +* `variable`:\\[in\\] Address of the variable to store the option value. +* `init_value`:\\[in\\] The initial value of the option variable. +* `help_string`:\\[in\\] Help string for usage message, may be NULL. ### Prototype ```c -void t8_forest_partition_create_offsets (t8_forest_t forest); +void sc_options_add_int (sc_options_t * opt, int opt_char, const char *opt_name, int *variable, int init_value, const char *help_string); ``` """ -function t8_forest_partition_create_offsets(forest) - @ccall libt8.t8_forest_partition_create_offsets(forest::t8_forest_t)::Cvoid +function sc_options_add_int(opt, opt_char, opt_name, variable, init_value, help_string) + @ccall libt8.sc_options_add_int(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Cint}, init_value::Cint, help_string::Cstring)::Cvoid end """ - t8_forest_partition_next_nonempty_rank(forest, rank) + sc_options_add_size_t(opt, opt_char, opt_name, variable, init_value, help_string) -If t8_forest_partition_create_offsets was already called, compute for a given rank the next greater rank that is not empty. +Add an option that takes a size\\_t argument. The value of the size\\_t variable must not be greater than LLONG\\_MAX. # Arguments -* `forest`:\\[in\\] The forest. -* `rank`:\\[in\\] An MPI rank. -# Returns -A rank q > *rank* such that the forest has elements on *q*. If such a *q* does not exist, returns mpisize. +* `opt`:\\[in,out\\] A valid options structure. +* `opt_char`:\\[in\\] Short option character, may be '\\0'. +* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. +* `variable`:\\[in\\] Address of the variable to store the option value. +* `init_value`:\\[in\\] The initial value of the option variable. +* `help_string`:\\[in\\] Help string for usage message, may be NULL. ### Prototype ```c -int t8_forest_partition_next_nonempty_rank (t8_forest_t forest, int rank); +void sc_options_add_size_t (sc_options_t * opt, int opt_char, const char *opt_name, size_t *variable, size_t init_value, const char *help_string); ``` """ -function t8_forest_partition_next_nonempty_rank(forest, rank) - @ccall libt8.t8_forest_partition_next_nonempty_rank(forest::t8_forest_t, rank::Cint)::Cint +function sc_options_add_size_t(opt, opt_char, opt_name, variable, init_value, help_string) + @ccall libt8.sc_options_add_size_t(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Csize_t}, init_value::Csize_t, help_string::Cstring)::Cvoid end """ - t8_forest_partition_create_first_desc(forest) + sc_options_add_double(opt, opt_char, opt_name, variable, init_value, help_string) -Create the array of global\\_first\\_descendant ids of a partitioned forest. +Add an option that takes a double argument. The double must be in the legal range. "inf" and "nan" are legal too. # Arguments -* `forest`:\\[in,out\\] The forest. *forest* must be committed before calling this function. +* `opt`:\\[in,out\\] A valid options structure. +* `opt_char`:\\[in\\] Short option character, may be '\\0'. +* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. +* `variable`:\\[in\\] Address of the variable to store the option value. +* `init_value`:\\[in\\] The initial value of the option variable. +* `help_string`:\\[in\\] Help string for usage message, may be NULL. ### Prototype ```c -void t8_forest_partition_create_first_desc (t8_forest_t forest); +void sc_options_add_double (sc_options_t * opt, int opt_char, const char *opt_name, double *variable, double init_value, const char *help_string); ``` """ -function t8_forest_partition_create_first_desc(forest) - @ccall libt8.t8_forest_partition_create_first_desc(forest::t8_forest_t)::Cvoid +function sc_options_add_double(opt, opt_char, opt_name, variable, init_value, help_string) + @ccall libt8.sc_options_add_double(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Cdouble}, init_value::Cdouble, help_string::Cstring)::Cvoid end """ - t8_forest_partition_create_tree_offsets(forest) + sc_options_add_string(opt, opt_char, opt_name, variable, init_value, help_string) -Create the array tree offsets of a partitioned forest. This arrays stores at position p the global id of the first tree of this process. Or if this tree is shared, it stores -(global\\_id) - 1. +Add a string option. # Arguments -* `forest`:\\[in,out\\] The forest. *forest* must be committed before calling this function. +* `opt`:\\[in,out\\] A valid options structure. +* `opt_char`:\\[in\\] Short option character, may be '\\0'. +* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. +* `variable`:\\[in\\] Address of the variable to store the option value. +* `init_value`:\\[in\\] This default value of the option may be NULL. If not NULL, the value is copied to internal storage. +* `help_string`:\\[in\\] Help string for usage message, may be NULL. ### Prototype ```c -void t8_forest_partition_create_tree_offsets (t8_forest_t forest); +void sc_options_add_string (sc_options_t * opt, int opt_char, const char *opt_name, const char **variable, const char *init_value, const char *help_string); ``` """ -function t8_forest_partition_create_tree_offsets(forest) - @ccall libt8.t8_forest_partition_create_tree_offsets(forest::t8_forest_t)::Cvoid +function sc_options_add_string(opt, opt_char, opt_name, variable, init_value, help_string) + @ccall libt8.sc_options_add_string(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Cstring}, init_value::Cstring, help_string::Cstring)::Cvoid end """ - t8_forest_partition_data(forest_from, forest_to, data_in, data_out) - -Re-Partition an array accordingly to a partitioned forest. - -!!! note + sc_options_add_inifile(opt, opt_char, opt_name, help_string) - *data_in* has to be of size equal to the number of local elements of *forest_from* *data_out* has to be already allocated and has to be of size equal to the number of local elements of *forest_to*. +Add an option to read in a file in `.ini` format. The argument to this option must be a filename. On parsing the specified file is read to set known option variables. It does not have an associated option variable itself. # Arguments -* `forest_form`:\\[in\\] The forest before the partitioning step. -* `forest_to`:\\[in\\] The partitioned forest of *forest_from*. -* `data_in`:\\[in\\] A pointer to an [`sc_array_t`](@ref) holding data (one value per element) accordingly to *forest_from*. -* `data_out`:\\[in,out\\] A pointer to an already allocated [`sc_array_t`](@ref) capable of holding data accordingly to *forest_to*. +* `opt`:\\[in,out\\] A valid options structure. +* `opt_char`:\\[in\\] Short option character, may be '\\0'. +* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. +* `help_string`:\\[in\\] Help string for usage message, may be NULL. ### Prototype ```c -void t8_forest_partition_data (t8_forest_t forest_from, t8_forest_t forest_to, const sc_array_t *data_in, sc_array_t *data_out); +void sc_options_add_inifile (sc_options_t * opt, int opt_char, const char *opt_name, const char *help_string); ``` """ -function t8_forest_partition_data(forest_from, forest_to, data_in, data_out) - @ccall libt8.t8_forest_partition_data(forest_from::t8_forest_t, forest_to::t8_forest_t, data_in::Ptr{sc_array_t}, data_out::Ptr{sc_array_t})::Cvoid +function sc_options_add_inifile(opt, opt_char, opt_name, help_string) + @ccall libt8.sc_options_add_inifile(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, help_string::Cstring)::Cvoid end """ - t8_forest_partition_test_boundary_element(forest) - -Test if the last descendant of the last element of current rank has a smaller linear id than the stored first descendant of rank+1. If this is not the case, elements overlap. + sc_options_add_jsonfile(opt, opt_char, opt_name, help_string) -!!! note +Add an option to read in a file in JSON format. The argument to this option must be a filename. On parsing the specified file is read to set known option variables. It does not have an associated option variable itself. - *forest* must be committed before calling this function. +This functionality is only active when sc_have_json returns true, equivalent to the define SC\\_HAVE\\_JSON existing, and ignored otherwise. # Arguments -* `forest`:\\[in\\] The forest. +* `opt`:\\[in,out\\] A valid options structure. +* `opt_char`:\\[in\\] Short option character, may be '\\0'. +* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. +* `help_string`:\\[in\\] Help string for usage message, may be NULL. ### Prototype ```c -void t8_forest_partition_test_boundary_element (const t8_forest_t forest); +void sc_options_add_jsonfile (sc_options_t * opt, int opt_char, const char *opt_name, const char *help_string); ``` """ -function t8_forest_partition_test_boundary_element(forest) - @ccall libt8.t8_forest_partition_test_boundary_element(forest::t8_forest_t)::Cvoid +function sc_options_add_jsonfile(opt, opt_char, opt_name, help_string) + @ccall libt8.sc_options_add_jsonfile(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, help_string::Cstring)::Cvoid end """ - t8_forest_set_profiling(forest, set_profiling) + sc_options_add_callback(opt, opt_char, opt_name, has_arg, fn, data, help_string) + +Add an option that calls a user-defined function when parsed. The callback function should be implemented to allow multiple calls. The callback may be used to set multiple option variables in bulk that would otherwise require an inconvenient number of individual options. This option is not loaded from or saved to files. +# Arguments +* `opt`:\\[in,out\\] A valid options structure. +* `opt_char`:\\[in\\] Short option character, may be '\\0'. +* `opt_name`:\\[in\\] Long option name without initial dashes, may be NULL. +* `has_arg`:\\[in\\] Specify whether the option needs an option argument. This can be 0 for none, 1 for a required argument, and 2 for an optional argument; see getopt\\_long (3). +* `fn`:\\[in\\] Function to call when this option is encountered. +* `data`:\\[in\\] User-defined data passed to the callback. +* `help_string`:\\[in\\] Help string for usage message, may be NULL. ### Prototype ```c -void t8_forest_set_profiling (t8_forest_t forest, int set_profiling); +void sc_options_add_callback (sc_options_t * opt, int opt_char, const char *opt_name, int has_arg, sc_options_callback_t fn, void *data, const char *help_string); ``` """ -function t8_forest_set_profiling(forest, set_profiling) - @ccall libt8.t8_forest_set_profiling(forest::t8_forest_t, set_profiling::Cint)::Cvoid +function sc_options_add_callback(opt, opt_char, opt_name, has_arg, fn, data, help_string) + @ccall libt8.sc_options_add_callback(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, has_arg::Cint, fn::sc_options_callback_t, data::Ptr{Cvoid}, help_string::Cstring)::Cvoid end """ - t8_forest_compute_profile(forest) + sc_options_add_keyvalue(opt, opt_char, opt_name, variable, init_value, keyvalue, help_string) + +Add an option that takes string keys into a lookup table of integers. On calling this function, it must be certain that the initial value exists. +# Arguments +* `opt`:\\[in\\] Initialized options structure. +* `opt_char`:\\[in\\] Option character for command line, or 0. +* `opt_name`:\\[in\\] Name of the long option, or NULL. +* `variable`:\\[in\\] Address of an existing integer that holds the value of this option parameter. +* `init_value`:\\[in\\] The key that is looked up for the initial value. It must be certain that the key exists and its value is of type integer. +* `keyvalue`:\\[in\\] A valid key-value structure where the values must be integers. If a key is asked for that does not exist, we will produce an option error. This structure must stay alive as long as opt. +* `help_string`:\\[in\\] Instructive one-line string to explain the option. ### Prototype ```c -void t8_forest_compute_profile (t8_forest_t forest); +void sc_options_add_keyvalue (sc_options_t * opt, int opt_char, const char *opt_name, int *variable, const char *init_value, sc_keyvalue_t * keyvalue, const char *help_string); ``` """ -function t8_forest_compute_profile(forest) - @ccall libt8.t8_forest_compute_profile(forest::t8_forest_t)::Cvoid +function sc_options_add_keyvalue(opt, opt_char, opt_name, variable, init_value, keyvalue, help_string) + @ccall libt8.sc_options_add_keyvalue(opt::Ptr{sc_options_t}, opt_char::Cint, opt_name::Cstring, variable::Ptr{Cint}, init_value::Cstring, keyvalue::Ptr{sc_keyvalue_t}, help_string::Cstring)::Cvoid end """ - t8_forest_profile_get_adapt_stats(forest) + sc_options_add_suboptions(opt, subopt, prefix) + +Copy one set of options to another as a subset, with a prefix. The variables referenced by the options and the suboptions are the same. +# Arguments +* `opt`:\\[in,out\\] A set of options. +* `subopt`:\\[in\\] Another set of options to be copied. +* `prefix`:\\[in\\] The prefix to add to option names as they are copied. If an option has a long name "name" in subopt, its name in opt is "prefix:name"; if an option only has a character 'c' in subopt, its name in opt is "prefix:-c". ### Prototype ```c -const sc_statinfo_t * t8_forest_profile_get_adapt_stats (t8_forest_t forest); +void sc_options_add_suboptions (sc_options_t * opt, sc_options_t * subopt, const char *prefix); ``` """ -function t8_forest_profile_get_adapt_stats(forest) - @ccall libt8.t8_forest_profile_get_adapt_stats(forest::t8_forest_t)::Ptr{sc_statinfo_t} +function sc_options_add_suboptions(opt, subopt, prefix) + @ccall libt8.sc_options_add_suboptions(opt::Ptr{sc_options_t}, subopt::Ptr{sc_options_t}, prefix::Cstring)::Cvoid end """ - t8_forest_profile_get_ghost_stats(forest) + sc_options_print_usage(package_id, log_priority, opt, arg_usage) + +Print a usage message. This function uses the [`SC_LC_GLOBAL`](@ref) log category. That means the default action is to print only on rank 0. Applications can change that by providing a user-defined log handler. +# Arguments +* `package_id`:\\[in\\] Registered package id or -1. +* `log_priority`:\\[in\\] Priority for output according to sc_logprios. +* `opt`:\\[in\\] The option structure. +* `arg_usage`:\\[in\\] If not NULL, an string is appended to the usage line. If the string is non-empty, it will be printed after the option summary and an "ARGUMENTS:\\n" title line. Line breaks are identified by strtok(3) and honored. ### Prototype ```c -const sc_statinfo_t * t8_forest_profile_get_ghost_stats (t8_forest_t forest); +void sc_options_print_usage (int package_id, int log_priority, sc_options_t * opt, const char *arg_usage); ``` """ -function t8_forest_profile_get_ghost_stats(forest) - @ccall libt8.t8_forest_profile_get_ghost_stats(forest::t8_forest_t)::Ptr{sc_statinfo_t} +function sc_options_print_usage(package_id, log_priority, opt, arg_usage) + @ccall libt8.sc_options_print_usage(package_id::Cint, log_priority::Cint, opt::Ptr{sc_options_t}, arg_usage::Cstring)::Cvoid end """ - t8_forest_profile_get_partition_stats(forest) + sc_options_print_summary(package_id, log_priority, opt) + +Print a summary of all option values. Prints the title "Options:" and a line for every option, then the title "Arguments:" and a line for every argument. This function uses the [`SC_LC_GLOBAL`](@ref) log category. That means the default action is to print only on rank 0. Applications can change that by providing a user-defined log handler. +# Arguments +* `package_id`:\\[in\\] Registered package id or -1. +* `log_priority`:\\[in\\] Priority for output according to sc_logprios. +* `opt`:\\[in\\] The option structure. ### Prototype ```c -const sc_statinfo_t * t8_forest_profile_get_partition_stats (t8_forest_t forest); +void sc_options_print_summary (int package_id, int log_priority, sc_options_t * opt); ``` """ -function t8_forest_profile_get_partition_stats(forest) - @ccall libt8.t8_forest_profile_get_partition_stats(forest::t8_forest_t)::Ptr{sc_statinfo_t} +function sc_options_print_summary(package_id, log_priority, opt) + @ccall libt8.sc_options_print_summary(package_id::Cint, log_priority::Cint, opt::Ptr{sc_options_t})::Cvoid end """ - t8_forest_profile_get_commit_stats(forest) + sc_options_load(package_id, err_priority, opt, file) +Load a file in the default format and update option values. The default is a file in the `.ini` format; see sc_options_load_ini. + +# Arguments +* `package_id`:\\[in\\] Registered package id or -1. +* `err_priority`:\\[in\\] Error priority according to sc_logprios. +* `opt`:\\[in\\] The option structure. +* `file`:\\[in\\] Filename of the file to load. +# Returns +Returns 0 on success, -1 on failure. ### Prototype ```c -const sc_statinfo_t * t8_forest_profile_get_commit_stats (t8_forest_t forest); +int sc_options_load (int package_id, int err_priority, sc_options_t * opt, const char *file); ``` """ -function t8_forest_profile_get_commit_stats(forest) - @ccall libt8.t8_forest_profile_get_commit_stats(forest::t8_forest_t)::Ptr{sc_statinfo_t} +function sc_options_load(package_id, err_priority, opt, file) + @ccall libt8.sc_options_load(package_id::Cint, err_priority::Cint, opt::Ptr{sc_options_t}, file::Cstring)::Cint end """ - t8_forest_profile_get_balance_stats(forest) + sc_options_load_ini(package_id, err_priority, opt, inifile, re) + +Load a file in `.ini` format and update entries found under [Options]. An option whose name contains a colon such as "prefix:basename" will be updated by a "basename =" entry in a [prefix] section. +# Arguments +* `package_id`:\\[in\\] Registered package id or -1. +* `err_priority`:\\[in\\] Error priority according to sc_logprios. +* `opt`:\\[in\\] The option structure. +* `inifile`:\\[in\\] Filename of the ini file to load. +* `re`:\\[in,out\\] Provisioned for runtime error checking implementation; currently must be NULL. +# Returns +Returns 0 on success, -1 on failure. ### Prototype ```c -const sc_statinfo_t * t8_forest_profile_get_balance_stats (t8_forest_t forest); +int sc_options_load_ini (int package_id, int err_priority, sc_options_t * opt, const char *inifile, void *re); ``` """ -function t8_forest_profile_get_balance_stats(forest) - @ccall libt8.t8_forest_profile_get_balance_stats(forest::t8_forest_t)::Ptr{sc_statinfo_t} +function sc_options_load_ini(package_id, err_priority, opt, inifile, re) + @ccall libt8.sc_options_load_ini(package_id::Cint, err_priority::Cint, opt::Ptr{sc_options_t}, inifile::Cstring, re::Ptr{Cvoid})::Cint end """ - t8_forest_profile_get_balance_rounds_stats(forest) + sc_options_load_json(package_id, err_priority, opt, jsonfile, re) + +Load a file in JSON format and update entries from object "Options". An option whose name contains a colon such as "Prefix:basename" will be updated by a "basename :" entry in a "Prefix" nested object. +# Arguments +* `package_id`:\\[in\\] Registered package id or -1. +* `err_priority`:\\[in\\] Error priority according to sc_logprios. +* `opt`:\\[in\\] The option structure. +* `jsonfile`:\\[in\\] Filename of the JSON file to load. +* `re`:\\[in,out\\] Provisioned for runtime error checking implementation; currently must be NULL. +# Returns +Returns 0 on success, -1 on failure. ### Prototype ```c -const sc_statinfo_t * t8_forest_profile_get_balance_rounds_stats (t8_forest_t forest); +int sc_options_load_json (int package_id, int err_priority, sc_options_t * opt, const char *jsonfile, void *re); ``` """ -function t8_forest_profile_get_balance_rounds_stats(forest) - @ccall libt8.t8_forest_profile_get_balance_rounds_stats(forest::t8_forest_t)::Ptr{sc_statinfo_t} +function sc_options_load_json(package_id, err_priority, opt, jsonfile, re) + @ccall libt8.sc_options_load_json(package_id::Cint, err_priority::Cint, opt::Ptr{sc_options_t}, jsonfile::Cstring, re::Ptr{Cvoid})::Cint end """ - t8_forest_print_profile(forest) + sc_options_save(package_id, err_priority, opt, inifile) + +Save all options and arguments to a file in `.ini` format. This function must only be called after successful option parsing. This function should only be called on rank 0. This function will log errors with category [`SC_LC_GLOBAL`](@ref). An options whose name contains a colon such as "Prefix:basename" will be written in a section titled [Prefix] as "basename =". +# Arguments +* `package_id`:\\[in\\] Registered package id or -1. +* `err_priority`:\\[in\\] Error priority according to sc_logprios. +* `opt`:\\[in\\] The option structure. +* `inifile`:\\[in\\] Filename of the ini file to save. +# Returns +Returns 0 on success, -1 on failure. ### Prototype ```c -void t8_forest_print_profile (t8_forest_t forest); +int sc_options_save (int package_id, int err_priority, sc_options_t * opt, const char *inifile); ``` """ -function t8_forest_print_profile(forest) - @ccall libt8.t8_forest_print_profile(forest::t8_forest_t)::Cvoid +function sc_options_save(package_id, err_priority, opt, inifile) + @ccall libt8.sc_options_save(package_id::Cint, err_priority::Cint, opt::Ptr{sc_options_t}, inifile::Cstring)::Cint end """ - t8_forest_profile_get_adapt_time(forest) + sc_options_load_args(package_id, err_priority, opt, inifile) + +Load a file in `.ini` format and update entries found under [Arguments]. There needs to be a key Arguments.count specifying the number. Then as many integer keys starting with 0 need to be present. +# Arguments +* `package_id`:\\[in\\] Registered package id or -1. +* `err_priority`:\\[in\\] Error priority according to sc_logprios. +* `opt`:\\[in\\] The args are stored in this option structure. +* `inifile`:\\[in\\] Filename of the ini file to load. +# Returns +Returns 0 on success, -1 on failure. ### Prototype ```c -double t8_forest_profile_get_adapt_time (t8_forest_t forest); +int sc_options_load_args (int package_id, int err_priority, sc_options_t * opt, const char *inifile); ``` """ -function t8_forest_profile_get_adapt_time(forest) - @ccall libt8.t8_forest_profile_get_adapt_time(forest::t8_forest_t)::Cdouble +function sc_options_load_args(package_id, err_priority, opt, inifile) + @ccall libt8.sc_options_load_args(package_id::Cint, err_priority::Cint, opt::Ptr{sc_options_t}, inifile::Cstring)::Cint end """ - t8_forest_profile_get_partition_time(forest, procs_sent) + sc_options_parse(package_id, err_priority, opt, argc, argv) +Parse command line options. + +# Arguments +* `package_id`:\\[in\\] Registered package id or -1. +* `err_priority`:\\[in\\] Error priority according to sc_logprios. +* `opt`:\\[in\\] The option structure. +* `argc`:\\[in\\] Length of argument list. +* `argv`:\\[in,out\\] Argument list may be permuted. +# Returns +Returns -1 on an invalid option, otherwise the position of the first non-option argument. ### Prototype ```c -double t8_forest_profile_get_partition_time (t8_forest_t forest, int *procs_sent); +int sc_options_parse (int package_id, int err_priority, sc_options_t * opt, int argc, char **argv); ``` """ -function t8_forest_profile_get_partition_time(forest, procs_sent) - @ccall libt8.t8_forest_profile_get_partition_time(forest::t8_forest_t, procs_sent::Ptr{Cint})::Cdouble +function sc_options_parse(package_id, err_priority, opt, argc, argv) + @ccall libt8.sc_options_parse(package_id::Cint, err_priority::Cint, opt::Ptr{sc_options_t}, argc::Cint, argv::Ptr{Cstring})::Cint end """ - t8_forest_profile_get_balance_time(forest, balance_rounds) + t8_cmesh_from_tetgen_file(fileprefix, partition, comm, do_dup) ### Prototype ```c -double t8_forest_profile_get_balance_time (t8_forest_t forest, int *balance_rounds); +t8_cmesh_t t8_cmesh_from_tetgen_file (char *fileprefix, int partition, sc_MPI_Comm comm, int do_dup); ``` """ -function t8_forest_profile_get_balance_time(forest, balance_rounds) - @ccall libt8.t8_forest_profile_get_balance_time(forest::t8_forest_t, balance_rounds::Ptr{Cint})::Cdouble +function t8_cmesh_from_tetgen_file(fileprefix, partition, comm, do_dup) + @ccall libt8.t8_cmesh_from_tetgen_file(fileprefix::Cstring, partition::Cint, comm::Cint, do_dup::Cint)::t8_cmesh_t end """ - t8_forest_profile_get_ghost_time(forest, ghosts_sent) + t8_cmesh_from_tetgen_file_time(fileprefix, partition, comm, do_dup, fi, snapshot, stats, statentry) ### Prototype ```c -double t8_forest_profile_get_ghost_time (t8_forest_t forest, t8_locidx_t *ghosts_sent); +t8_cmesh_t t8_cmesh_from_tetgen_file_time (char *fileprefix, int partition, sc_MPI_Comm comm, int do_dup, sc_flopinfo_t *fi, sc_flopinfo_t *snapshot, sc_statinfo_t *stats, int statentry); ``` """ -function t8_forest_profile_get_ghost_time(forest, ghosts_sent) - @ccall libt8.t8_forest_profile_get_ghost_time(forest::t8_forest_t, ghosts_sent::Ptr{Cint})::Cdouble +function t8_cmesh_from_tetgen_file_time(fileprefix, partition, comm, do_dup, fi, snapshot, stats, statentry) + @ccall libt8.t8_cmesh_from_tetgen_file_time(fileprefix::Cstring, partition::Cint, comm::Cint, do_dup::Cint, fi::Ptr{sc_flopinfo_t}, snapshot::Ptr{sc_flopinfo_t}, stats::Ptr{sc_statinfo_t}, statentry::Cint)::t8_cmesh_t end """ - t8_forest_profile_get_ghostexchange_waittime(forest) + t8_cmesh_from_triangle_file(fileprefix, partition, comm, do_dup) ### Prototype ```c -double t8_forest_profile_get_ghostexchange_waittime (t8_forest_t forest); +t8_cmesh_t t8_cmesh_from_triangle_file (char *fileprefix, int partition, sc_MPI_Comm comm, int do_dup); ``` """ -function t8_forest_profile_get_ghostexchange_waittime(forest) - @ccall libt8.t8_forest_profile_get_ghostexchange_waittime(forest::t8_forest_t)::Cdouble -end - -""" - t8_profile - -| Field | Note | -| :----------------------------- | :--------------------------------------------------------------------------------------------------------------------- | -| partition\\_elements\\_shipped | The number of elements this process has sent to other in the last partition call. | -| partition\\_elements\\_recv | The number of elements this process has received from other in the last partition call. | -| partition\\_bytes\\_sent | The total number of bytes sent to other processes in the last partition call. | -| partition\\_procs\\_sent | The number of different processes this process has send local elements to in the last partition call. | -| ghosts\\_shipped | The number of ghost elements this process has sent to other processes. | -| ghosts\\_received | The number of ghost elements this process has received from other processes. | -| ghosts\\_remotes | The number of processes this process have sent ghost elements to (and received from). | -| balance\\_rounds | The number of iterations during balance. | -| adapt\\_runtime | The runtime of the last call to [`t8_forest_adapt`](@ref) (not counting adaptation in [`t8_forest_balance`](@ref)). | -| partition\\_runtime | The runtime of the last call to [`t8_cmesh_partition`](@ref) (not count in partition in [`t8_forest_balance`](@ref)). | -| ghost\\_runtime | The runtime of the last call to [`t8_forest_ghost_create`](@ref). | -| ghost\\_waittime | Amount of synchronisation time in ghost. | -| balance\\_runtime | The runtime of the last call to [`t8_forest_balance`](@ref). | -| commit\\_runtime | The runtime of the last call to [`t8_cmesh_commit`](@ref). | -""" -struct t8_profile - partition_elements_shipped::t8_locidx_t - partition_elements_recv::t8_locidx_t - partition_bytes_sent::Csize_t - partition_procs_sent::Cint - ghosts_shipped::t8_locidx_t - ghosts_received::t8_locidx_t - ghosts_remotes::Cint - balance_rounds::Cint - adapt_runtime::Cdouble - partition_runtime::Cdouble - ghost_runtime::Cdouble - ghost_waittime::Cdouble - balance_runtime::Cdouble - commit_runtime::Cdouble +function t8_cmesh_from_triangle_file(fileprefix, partition, comm, do_dup) + @ccall libt8.t8_cmesh_from_triangle_file(fileprefix::Cstring, partition::Cint, comm::Cint, do_dup::Cint)::t8_cmesh_t end -const t8_profile_t = t8_profile - -"""If a forest is to be derived from another forest, there are different possibilities how the original forest is modified. Currently we support: Copying, adapting, partitioning, and balancing a forest. The latter 3 can be combined, in which case the order is 1. Adapt, 2. Partition, 3. Balance. We store the methods in an int8\\_t and use these defines to distinguish between them.""" -const t8_forest_from_t = Int8 - -"""This structure is private to the implementation.""" -const t8_forest_struct_t = t8_forest - -"""The t8 tree datatype""" -const t8_tree_struct_t = t8_tree - -const t8_profile_struct_t = t8_profile - -const t8_forest_ghost_struct_t = t8_forest_ghost +mutable struct t8_cmesh_vertex_connectivity end """ - t8_geometry_type +[`t8_cmesh_vertex_connectivity_c`](@ref) -This enumeration contains all possible geometries. - -| Enumerator | Note | -| :--------------------------------------------- | :----------------------------------------------------------------------------------------------- | -| T8\\_GEOMETRY\\_TYPE\\_ZERO | The zero geometry maps all points to zero. | -| T8\\_GEOMETRY\\_TYPE\\_LINEAR | The linear geometry uses linear interpolations to interpolate between the tree vertices. | -| T8\\_GEOMETRY\\_TYPE\\_LINEAR\\_AXIS\\_ALIGNED | The linear, axis aligned geometry uses only 2 vertices, since it is axis aligned. | -| T8\\_GEOMETRY\\_TYPE\\_LAGRANGE | The Lagrange geometry uses a mapping with Lagrange polynomials to approximate curved elements . | -| T8\\_GEOMETRY\\_TYPE\\_ANALYTIC | The analytic geometry uses a user-defined analytic function to map into the physical domain. | -| T8\\_GEOMETRY\\_TYPE\\_CAD | The opencascade geometry uses CAD shapes to map trees exactly to the underlying CAD model. | -| T8\\_GEOMETRY\\_TYPE\\_COUNT | This is no geometry type but can be used as the number of geometry types. | -| T8\\_GEOMETRY\\_TYPE\\_UNDEFINED | This is no geometry type but is used for every geometry, where no type is defined | +Opaque pointer to the cmesh vertex connectivity structure. """ -@cenum t8_geometry_type::UInt32 begin - T8_GEOMETRY_TYPE_ZERO = 0 - T8_GEOMETRY_TYPE_LINEAR = 1 - T8_GEOMETRY_TYPE_LINEAR_AXIS_ALIGNED = 2 - T8_GEOMETRY_TYPE_LAGRANGE = 3 - T8_GEOMETRY_TYPE_ANALYTIC = 4 - T8_GEOMETRY_TYPE_CAD = 5 - T8_GEOMETRY_TYPE_COUNT = 6 - T8_GEOMETRY_TYPE_UNDEFINED = 7 -end - -"""This enumeration contains all possible geometries.""" -const t8_geometry_type_t = t8_geometry_type +const t8_cmesh_vertex_connectivity_c = Ptr{t8_cmesh_vertex_connectivity} """ - t8_geometry_evaluate(cmesh, gtreeid, ref_coords, num_coords, out_coords) - -Evaluates the geometry of a tree at a given reference point. + t8_cmesh_set_global_vertices_of_tree(cmesh, global_tree, global_tree_vertices, num_vertices) -# Arguments -* `cmesh`:\\[in\\] The cmesh -* `gtreeid`:\\[in\\] The global id of the tree -* `ref_coords`:\\[in\\] The reference coordinates at which to evaluate the geometry -* `num_coords`:\\[in\\] The number of reference coordinates -* `out_coords`:\\[out\\] The evaluated coordinates ### Prototype ```c -void t8_geometry_evaluate (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, double *out_coords); +void t8_cmesh_set_global_vertices_of_tree (const t8_cmesh_t cmesh, const t8_gloidx_t global_tree, const t8_gloidx_t *global_tree_vertices, const int num_vertices); ``` """ -function t8_geometry_evaluate(cmesh, gtreeid, ref_coords, num_coords, out_coords) - @ccall libt8.t8_geometry_evaluate(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, out_coords::Ptr{Cdouble})::Cvoid +function t8_cmesh_set_global_vertices_of_tree(cmesh, global_tree, global_tree_vertices, num_vertices) + @ccall libt8.t8_cmesh_set_global_vertices_of_tree(cmesh::Cint, global_tree::Cint, global_tree_vertices::Ptr{Cint}, num_vertices::Cint)::Cvoid end """ - t8_geometry_jacobian(cmesh, gtreeid, ref_coords, num_coords, jacobian) - -Evaluates the jacobian of a tree at a given reference point. + t8_cmesh_get_num_global_vertices(cmesh) -# Arguments -* `cmesh`:\\[in\\] The cmesh -* `gtreeid`:\\[in\\] The global id of the tree -* `ref_coords`:\\[in\\] The reference coordinates at which to evaluate the jacobian -* `num_coords`:\\[in\\] The number of reference coordinates -* `jacobian`:\\[out\\] The jacobian at the reference coordinates ### Prototype ```c -void t8_geometry_jacobian (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, double *jacobian); +t8_gloidx_t t8_cmesh_get_num_global_vertices (const t8_cmesh_t cmesh); ``` """ -function t8_geometry_jacobian(cmesh, gtreeid, ref_coords, num_coords, jacobian) - @ccall libt8.t8_geometry_jacobian(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, jacobian::Ptr{Cdouble})::Cvoid +function t8_cmesh_get_num_global_vertices(cmesh) + @ccall libt8.t8_cmesh_get_num_global_vertices(cmesh::Cint)::Cint end """ - t8_geometry_get_type(cmesh, gtreeid) - -This function returns the geometry type of a tree. + t8_cmesh_get_num_local_vertices(cmesh) -# Arguments -* `cmesh`:\\[in\\] The cmesh -* `gtreeid`:\\[in\\] The global id of the tree -# Returns -The geometry type of the tree with id gtreeid ### Prototype ```c -t8_geometry_type_t t8_geometry_get_type (t8_cmesh_t cmesh, t8_gloidx_t gtreeid); +t8_locidx_t t8_cmesh_get_num_local_vertices (const t8_cmesh_t cmesh); ``` """ -function t8_geometry_get_type(cmesh, gtreeid) - @ccall libt8.t8_geometry_get_type(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t)::t8_geometry_type_t +function t8_cmesh_get_num_local_vertices(cmesh) + @ccall libt8.t8_cmesh_get_num_local_vertices(cmesh::Cint)::Cint end """ - t8_geometry_tree_negative_volume(cmesh, gtreeid) - -Check if a tree has a negative volume + t8_cmesh_get_global_vertices_of_tree(cmesh, local_tree, num_vertices) -# Arguments -* `cmesh`:\\[in\\] The cmesh to check -* `gtreeid`:\\[in\\] The global id of the tree -# Returns -True if the tree with id gtreeid has a negative volume. False otherwise. ### Prototype ```c -int t8_geometry_tree_negative_volume (const t8_cmesh_t cmesh, const t8_gloidx_t gtreeid); +const t8_gloidx_t * t8_cmesh_get_global_vertices_of_tree (const t8_cmesh_t cmesh, const t8_locidx_t local_tree, int *num_vertices); ``` """ -function t8_geometry_tree_negative_volume(cmesh, gtreeid) - @ccall libt8.t8_geometry_tree_negative_volume(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t)::Cint +function t8_cmesh_get_global_vertices_of_tree(cmesh, local_tree, num_vertices) + @ccall libt8.t8_cmesh_get_global_vertices_of_tree(cmesh::Cint, local_tree::Cint, num_vertices::Ptr{Cint})::Ptr{Cint} end """ - t8_geom_get_name(geom) - -Get the name of a geometry. + t8_cmesh_get_global_vertex_of_tree(cmesh, local_tree, local_tree_vertex) -# Arguments -* `geom`:\\[in\\] A geometry. -# Returns -The name of *geom*. ### Prototype ```c -const char * t8_geom_get_name (const t8_geometry_c *geom); +t8_gloidx_t t8_cmesh_get_global_vertex_of_tree (const t8_cmesh_t cmesh, const t8_locidx_t local_tree, const int local_tree_vertex); ``` """ -function t8_geom_get_name(geom) - @ccall libt8.t8_geom_get_name(geom::Ptr{t8_geometry_c})::Cstring +function t8_cmesh_get_global_vertex_of_tree(cmesh, local_tree, local_tree_vertex) + @ccall libt8.t8_cmesh_get_global_vertex_of_tree(cmesh::Cint, local_tree::Cint, local_tree_vertex::Cint)::Cint end """ - t8_geom_get_type(geom) - -Get the type of a geometry. + t8_cmesh_get_num_trees_at_vertex(cmesh, global_vertex) -# Arguments -* `geom`:\\[in\\] A geometry. -# Returns -The type of *geom*. ### Prototype ```c -t8_geometry_type_t t8_geom_get_type (const t8_geometry_c *geom); +int t8_cmesh_get_num_trees_at_vertex (const t8_cmesh_t cmesh, t8_gloidx_t global_vertex); ``` """ -function t8_geom_get_type(geom) - @ccall libt8.t8_geom_get_type(geom::Ptr{t8_geometry_c})::t8_geometry_type_t +function t8_cmesh_get_num_trees_at_vertex(cmesh, global_vertex) + @ccall libt8.t8_cmesh_get_num_trees_at_vertex(cmesh::Cint, global_vertex::Cint)::Cint end """ - t8_geom_compute_linear_geometry(tree_class, tree_vertices, ref_coords, num_coords, out_coords) + t8_cmesh_uses_vertex_connectivity(cmesh) ### Prototype ```c -void t8_geom_compute_linear_geometry (t8_eclass_t tree_class, const double *tree_vertices, const double *ref_coords, const size_t num_coords, double *out_coords); +int t8_cmesh_uses_vertex_connectivity (const t8_cmesh_t cmesh); ``` """ -function t8_geom_compute_linear_geometry(tree_class, tree_vertices, ref_coords, num_coords, out_coords) - @ccall libt8.t8_geom_compute_linear_geometry(tree_class::Cint, tree_vertices::Ptr{Cdouble}, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, out_coords::Ptr{Cdouble})::Cvoid +function t8_cmesh_uses_vertex_connectivity(cmesh) + @ccall libt8.t8_cmesh_uses_vertex_connectivity(cmesh::Cint)::Cint end +# typedef int ( * t8_search_element_callback_c_wrapper ) ( t8_forest_t forest , const t8_locidx_t ltreeid , const t8_element_t * element , const int is_leaf , const t8_element_array_t * leaf_elements , const t8_locidx_t tree_leaf_index , void * user_data ) """ - t8_geom_compute_linear_axis_aligned_geometry(tree_class, tree_vertices, ref_coords, num_coords, out_coords) +A call-back function used by t8_forest_init_search for searching elements. Is called on an element and the search criterion should be checked on that element. Return true if the search criterion is met, false otherwise. -### Prototype -```c -void t8_geom_compute_linear_axis_aligned_geometry (t8_eclass_t tree_class, const double *tree_vertices, const double *ref_coords, const size_t num_coords, double *out_coords); -``` +# Arguments +* `forest`:\\[in\\] the forest +* `ltreeid`:\\[in\\] the local tree id of the current tree in the cmesh. +* `element`:\\[in\\] the element for which the search criterion is checked +* `is_leaf`:\\[in\\] true if and only if *element* is a leaf element +* `leaf_elements`:\\[in\\] the leaf elements in *forest* +* `tree_leaf_index`:\\[in\\] the local index of the first leaf in *leaf_elements* +* `user_data`:\\[in\\] a user data pointer that can be set by the user +# Returns +non-zero if the search criterion is met, zero otherwise. """ -function t8_geom_compute_linear_axis_aligned_geometry(tree_class, tree_vertices, ref_coords, num_coords, out_coords) - @ccall libt8.t8_geom_compute_linear_axis_aligned_geometry(tree_class::Cint, tree_vertices::Ptr{Cdouble}, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, out_coords::Ptr{Cdouble})::Cvoid -end +const t8_search_element_callback_c_wrapper = Ptr{Cvoid} +# typedef int ( * t8_search_queries_callback_c_wrapper ) ( t8_forest_t forest , const t8_locidx_t ltreeid , const t8_element_t * element , const int is_leaf , const t8_element_array_t * leaf_elements , const t8_locidx_t tree_leaf_index , void * queries , void * user_data ) """ - t8_geom_linear_interpolation(coefficients, corner_values, corner_value_dim, interpolation_dim, evaluated_function) - -Interpolates linearly between 2, bilinearly between 4 or trilineraly between 8 points. +A call-back function used by t8_forest_init_search_with_queries for searching elements and executing queries. Is called on an element and all queries are checked on that element. All positive queries are passed further down to the children of the element up to leaf elements of the tree. The results of the check are stored in *query_matches*. # Arguments -* `coefficients`:\\[in\\] An array of size at least dim giving the coefficients used for the interpolation -* `corner_values`:\\[in\\] An array of size 2^dim * 3, giving for each corner (in zorder) of the unit square/cube its function values in space. -* `corner_value_dim`:\\[in\\] The dimension of the *corner_values*. -* `interpolation_dim`:\\[in\\] The dimension of the interpolation (1 for linear, 2 for bilinear, 3 for trilinear) -* `evaluated_function`:\\[out\\] An array of size *corner_value_dim*, on output the result of the interpolation. -### Prototype -```c -void t8_geom_linear_interpolation (const double *coefficients, const double *corner_values, int corner_value_dim, int interpolation_dim, double *evaluated_function); -``` +* `forest`:\\[in\\] the forest +* `ltreeid`:\\[in\\] the local tree id of the current tree in the cmesh. +* `element`:\\[in\\] the element for which the search criterion is checked +* `is_leaf`:\\[in\\] true if and only if *element* is a leaf element +* `leaf_elements`:\\[in\\] the leaf elements in *forest* +* `tree_leaf_index`:\\[in\\] the local index of the first leaf in *leaf_elements* +* `queries`:\\[in\\] a pointer to an array of queries +* `user_data`:\\[in\\] a user data pointer that can be set by the user """ -function t8_geom_linear_interpolation(coefficients, corner_values, corner_value_dim, interpolation_dim, evaluated_function) - @ccall libt8.t8_geom_linear_interpolation(coefficients::Ptr{Cdouble}, corner_values::Ptr{Cdouble}, corner_value_dim::Cint, interpolation_dim::Cint, evaluated_function::Ptr{Cdouble})::Cvoid -end +const t8_search_queries_callback_c_wrapper = Ptr{Cvoid} +# typedef void ( * t8_search_batched_queries_callback_c_wrapper ) ( t8_forest_t forest , const t8_locidx_t ltreeid , const t8_element_t * element , const int is_leaf , const t8_element_array_t * leaf_elements , const t8_locidx_t tree_leaf_index , const void * queries , const size_t * active_query_indices , int * query_matches , void * user_data ) """ - t8_geom_triangular_interpolation(coefficients, corner_values, corner_value_dim, interpolation_dim, evaluated_function) - -Triangular interpolation between 3 points (triangle) or 4 points (tetrahedron) using cartesian coordinates. The input coefficients have to be given as coordinates in the reference triangle (interpolation\\_dim = 2) with points (0,0) (1,0) (1,1) or the reference tet (interpolation\\_dim = 3) with points (0,0,0) (1,0,0) (1,1,0) (1,1,1). +A call-back function used by t8_forest_init_search_with_batched_queries for searching elements and executing batched queries. Is called on an element and all queries are checked on that element. All positive queries are passed further down to the children of the element up to leaf elements of the tree. The results of the check are stored in *query_matches*. # Arguments -* `coefficients`:\\[in\\] An array of size *interpolation_dim* giving the coefficients in the reference triangle/tet used for the interpolation -* `corner_values`:\\[in\\] An array of size 3 * *corner_value_dim* for *interpolation_dim* == 2 or 4 * *corner_value_dim* for *interpolation_dim* == 3, giving the function values of the triangle/tetrahedron for each corner (in zorder) -* `corner_value_dim`:\\[in\\] The dimension of the *corner_values*. -* `interpolation_dim`:\\[in\\] The dimension of the interpolation (2 for triangle, 3 for tetrahedron) -* `evaluated_function`:\\[out\\] An array of size *corner_value_dim*, on output the result of the interpolation. -### Prototype -```c -void t8_geom_triangular_interpolation (const double *coefficients, const double *corner_values, int corner_value_dim, int interpolation_dim, double *evaluated_function); -``` +* `forest`:\\[in\\] the forest +* `ltreeid`:\\[in\\] the local tree id of the current tree in the cmesh. +* `element`:\\[in\\] the element for which the search criterion is checked +* `is_leaf`:\\[in\\] true if and only if *element* is a leaf element +* `leaf_elements`:\\[in\\] the leaf elements in *forest* +* `tree_leaf_index`:\\[in\\] the local index of the first leaf in *leaf_elements* +* `queries`:\\[in\\] a pointer to an array of queries +* `active_query_indices`:\\[in\\] a pointer to an array of indices of active queries in *queries* +* `query_matches`:\\[in,out\\] a pointer to an array of length *num_active_queries*. If query\\_matches[i] is true, then the element 'matches' the query of the active query with index active\\_query\\_indices[i]. +* `user_data`:\\[in\\] a user data pointer that can be set by the user """ -function t8_geom_triangular_interpolation(coefficients, corner_values, corner_value_dim, interpolation_dim, evaluated_function) - @ccall libt8.t8_geom_triangular_interpolation(coefficients::Ptr{Cdouble}, corner_values::Ptr{Cdouble}, corner_value_dim::Cint, interpolation_dim::Cint, evaluated_function::Ptr{Cdouble})::Cvoid -end +const t8_search_batched_queries_callback_c_wrapper = Ptr{Cvoid} -""" - t8_geom_get_face_vertices(tree_class, tree_vertices, face_index, dim, face_vertices) +mutable struct t8_forest_c_search end -### Prototype -```c -void t8_geom_get_face_vertices (t8_eclass_t tree_class, const double *tree_vertices, int face_index, int dim, double *face_vertices); -``` -""" -function t8_geom_get_face_vertices(tree_class, tree_vertices, face_index, dim, face_vertices) - @ccall libt8.t8_geom_get_face_vertices(tree_class::Cint, tree_vertices::Ptr{Cdouble}, face_index::Cint, dim::Cint, face_vertices::Ptr{Cdouble})::Cvoid -end +"""A wrapper around the forest search context""" +const t8_forest_search_c_wrapper = Ptr{t8_forest_c_search} """ - t8_geom_get_edge_vertices(tree_class, tree_vertices, edge_index, dim, edge_vertices) + t8_forest_init_search(search, element_callback, forest) ### Prototype ```c -void t8_geom_get_edge_vertices (t8_eclass_t tree_class, const double *tree_vertices, int edge_index, int dim, double *edge_vertices); +void t8_forest_init_search (t8_forest_search_c_wrapper search, t8_search_element_callback_c_wrapper element_callback, const t8_forest_t forest); ``` """ -function t8_geom_get_edge_vertices(tree_class, tree_vertices, edge_index, dim, edge_vertices) - @ccall libt8.t8_geom_get_edge_vertices(tree_class::Cint, tree_vertices::Ptr{Cdouble}, edge_index::Cint, dim::Cint, edge_vertices::Ptr{Cdouble})::Cvoid +function t8_forest_init_search(search, element_callback, forest) + @ccall libt8.t8_forest_init_search(search::t8_forest_search_c_wrapper, element_callback::t8_search_element_callback_c_wrapper, forest::Cint)::Cvoid end """ - t8_geom_get_ref_intersection(edge_index, ref_coords, ref_intersection) + t8_forest_search_update_forest(search, forest) -Calculates a point of intersection in a triangular reference space. The intersection is the extension of a straight line passing through a reference point and the opposite vertex of the edge. /|\\ / | \\ o -> reference point / o \\ x -> intersection point / | \\ /\\_\\_\\_\\_x\\_\\_\\_\\_\\ - -# Arguments -* `edge_index`:\\[in\\] Index of the edge, the intersection lies on. -* `ref_coords`:\\[in\\] Array containing the coordinates of the reference point. -* `ref_intersection`:\\[out\\] Coordinates of the intersection point. ### Prototype ```c -void t8_geom_get_ref_intersection (int edge_index, const double *ref_coords, double ref_intersection[2]); +void t8_forest_search_update_forest (t8_forest_search_c_wrapper search, const t8_forest_t forest); ``` """ -function t8_geom_get_ref_intersection(edge_index, ref_coords, ref_intersection) - @ccall libt8.t8_geom_get_ref_intersection(edge_index::Cint, ref_coords::Ptr{Cdouble}, ref_intersection::Ptr{Cdouble})::Cvoid +function t8_forest_search_update_forest(search, forest) + @ccall libt8.t8_forest_search_update_forest(search::t8_forest_search_c_wrapper, forest::Cint)::Cvoid end """ - t8_geom_get_triangle_scaling_factor(edge_index, tree_vertices, glob_intersection, glob_ref_point) + t8_forest_search_update_user_data(search, udata) -Calculates the scaling factor for edge displacement along a triangular tree face depending on the position of the global reference point. +Update the user data pointer in the search context # Arguments -* `edge_index`:\\[in\\] Index of the edge, whose displacement should be scaled. -* `tree_vertices`:\\[in\\] Array with the tree vertex coordinates. -* `glob_intersection`:\\[in\\] Array containing the coordinates of the intersection point of a line drawn from the opposite vertex through the glob\\_ref\\_point onto the edge with edge\\_index. -* `glob_ref_point`:\\[in\\] Array containing the coordinates of the reference point mapped into the global space. +* `search`:\\[in,out\\] the search context to update +* `udata`:\\[in\\] the new user data pointer to use ### Prototype ```c -double t8_geom_get_triangle_scaling_factor (int edge_index, const double *tree_vertices, const double *glob_intersection, const double *glob_ref_point); +void t8_forest_search_update_user_data (t8_forest_search_c_wrapper search, void *udata); ``` """ -function t8_geom_get_triangle_scaling_factor(edge_index, tree_vertices, glob_intersection, glob_ref_point) - @ccall libt8.t8_geom_get_triangle_scaling_factor(edge_index::Cint, tree_vertices::Ptr{Cdouble}, glob_intersection::Ptr{Cdouble}, glob_ref_point::Ptr{Cdouble})::Cdouble +function t8_forest_search_update_user_data(search, udata) + @ccall libt8.t8_forest_search_update_user_data(search::t8_forest_search_c_wrapper, udata::Ptr{Cvoid})::Cvoid end """ - t8_geom_get_scaling_factor_of_edge_on_face_tet(edge_index, face_index, ref_coords) + t8_forest_search_do_search(search) -Calculates the scaling factor for the displacement of an edge over a face of a tetrahedral element. +Perform the search # Arguments -* `edge_index`:\\[in\\] Index of the edge, whose displacement should be scaled. -* `face_index`:\\[in\\] Index of the face, the displacement should be scaled on. -* `ref_coords`:\\[in\\] Array containing the coordinates of the reference point. -# Returns -The scaling factor of the edge displacement on the face at the point of the reference coordinates. +* `search`:\\[in,out\\] the search context to use ### Prototype ```c -double t8_geom_get_scaling_factor_of_edge_on_face_tet (int edge_index, int face_index, const double *ref_coords); +void t8_forest_search_do_search (t8_forest_search_c_wrapper search); ``` """ -function t8_geom_get_scaling_factor_of_edge_on_face_tet(edge_index, face_index, ref_coords) - @ccall libt8.t8_geom_get_scaling_factor_of_edge_on_face_tet(edge_index::Cint, face_index::Cint, ref_coords::Ptr{Cdouble})::Cdouble +function t8_forest_search_do_search(search) + @ccall libt8.t8_forest_search_do_search(search::t8_forest_search_c_wrapper)::Cvoid end """ - t8_geom_get_tet_face_intersection(face_index, ref_coords, face_intersection) + t8_forest_search_destroy(search) -Calculates the face intersection of a ray passing trough the reference coordinates and the opposite vertex of that face for a tetrahedron. The coordinates of the face intersection are reference coordinates: [0,1]^3. +Destroy the search context # Arguments -* `face_index`:\\[in\\] Index of the face, on which the intersection should be calculated. -* `ref_coords`:\\[in\\] Array containing the coordinates of the reference point. -* `face_intersection`:\\[out\\] Three dimensional array containing the intersection point on the face in reference space. +* `search`:\\[in,out\\] the search context to destroy ### Prototype ```c -void t8_geom_get_tet_face_intersection (const int face_index, const double *ref_coords, double face_intersection[3]); +void t8_forest_search_destroy (t8_forest_search_c_wrapper search); ``` """ -function t8_geom_get_tet_face_intersection(face_index, ref_coords, face_intersection) - @ccall libt8.t8_geom_get_tet_face_intersection(face_index::Cint, ref_coords::Ptr{Cdouble}, face_intersection::Ptr{Cdouble})::Cvoid +function t8_forest_search_destroy(search) + @ccall libt8.t8_forest_search_destroy(search::t8_forest_search_c_wrapper)::Cvoid end -""" - t8_geom_get_scaling_factor_of_edge_on_face_prism(edge_index, face_index, ref_coords) +mutable struct t8_forest_search_with_queries end -Calculates the scaling factor for the displacement of an edge over a face of a prism element. +"""A wrapper around the forest search with queries context""" +const t8_forest_search_with_queries_c_wrapper = Ptr{t8_forest_search_with_queries} + +""" + t8_forest_init_search_with_queries(search_with_queries, element_callback, queries_callback, queries, num_queries, forest) -# Arguments -* `edge_index`:\\[in\\] Index of the edge, whose displacement should be scaled. -* `face_index`:\\[in\\] Index of the face, the displacement should be scaled on. -* `ref_coords`:\\[in\\] Array containing the coordinates of the reference point. -# Returns -The scaling factor of the edge displacement on the face at the point of the reference coordinates. ### Prototype ```c -double t8_geom_get_scaling_factor_of_edge_on_face_prism (int edge_index, int face_index, const double *ref_coords); +void t8_forest_init_search_with_queries (t8_forest_search_with_queries_c_wrapper search_with_queries, t8_search_element_callback_c_wrapper element_callback, t8_search_queries_callback_c_wrapper queries_callback, void **queries, const size_t num_queries, const t8_forest_t forest); ``` """ -function t8_geom_get_scaling_factor_of_edge_on_face_prism(edge_index, face_index, ref_coords) - @ccall libt8.t8_geom_get_scaling_factor_of_edge_on_face_prism(edge_index::Cint, face_index::Cint, ref_coords::Ptr{Cdouble})::Cdouble +function t8_forest_init_search_with_queries(search_with_queries, element_callback, queries_callback, queries, num_queries, forest) + @ccall libt8.t8_forest_init_search_with_queries(search_with_queries::t8_forest_search_with_queries_c_wrapper, element_callback::t8_search_element_callback_c_wrapper, queries_callback::t8_search_queries_callback_c_wrapper, queries::Ptr{Ptr{Cvoid}}, num_queries::Csize_t, forest::Cint)::Cvoid end """ - t8_geom_get_scaling_factor_face_through_volume_prism(face, ref_coords) - -Calculates the scaling factor for the displacement of an face through the volume of a prism element. + t8_forest_search_with_queries_update_forest(search_with_queries, forest) -# Arguments -* `face_index`:\\[in\\] Index of the displaced face. -* `ref_coords`:\\[in\\] Array containing the coordinates of the reference point. -# Returns -The scaling factor of the face displacement at the point of the reference coordinates inside the prism volume. ### Prototype ```c -double t8_geom_get_scaling_factor_face_through_volume_prism (const int face, const double *ref_coords); +void t8_forest_search_with_queries_update_forest (t8_forest_search_with_queries_c_wrapper search_with_queries, const t8_forest_t forest); ``` """ -function t8_geom_get_scaling_factor_face_through_volume_prism(face, ref_coords) - @ccall libt8.t8_geom_get_scaling_factor_face_through_volume_prism(face::Cint, ref_coords::Ptr{Cdouble})::Cdouble +function t8_forest_search_with_queries_update_forest(search_with_queries, forest) + @ccall libt8.t8_forest_search_with_queries_update_forest(search_with_queries::t8_forest_search_with_queries_c_wrapper, forest::Cint)::Cvoid end """ - t8_vertex_point_inside(vertex_coords, point, tolerance) + t8_forest_search_with_queries_update_user_data(search_with_queries, udata) -Check if a point lies inside a vertex +Update the user data pointer in the search with queries context # Arguments -* `vertex_coords`:\\[in\\] The coordinates of the vertex -* `point`:\\[in\\] The coordinates of the point to check -* `tolerance`:\\[in\\] A double > 0 defining the tolerance -# Returns -0 if the point is outside, 1 otherwise. +* `search_with_queries`:\\[in,out\\] the search with queries context to update +* `udata`:\\[in\\] the new user data pointer to use ### Prototype ```c -int t8_vertex_point_inside (const double vertex_coords[3], const double point[3], const double tolerance); +void t8_forest_search_with_queries_update_user_data (t8_forest_search_with_queries_c_wrapper search_with_queries, void *udata); ``` """ -function t8_vertex_point_inside(vertex_coords, point, tolerance) - @ccall libt8.t8_vertex_point_inside(vertex_coords::Ptr{Cdouble}, point::Ptr{Cdouble}, tolerance::Cdouble)::Cint +function t8_forest_search_with_queries_update_user_data(search_with_queries, udata) + @ccall libt8.t8_forest_search_with_queries_update_user_data(search_with_queries::t8_forest_search_with_queries_c_wrapper, udata::Ptr{Cvoid})::Cvoid end """ - t8_line_point_inside(p_0, vec, point, tolerance) + t8_forest_search_with_queries_update_queries(search_with_queries, queries, num_queries) -Check if a point is inside a line that is defined by a starting point *p_0* and a vector *vec* +Update the queries in the search with queries context # Arguments -* `p_0`:\\[in\\] Starting point of the line -* `vec`:\\[in\\] Direction of the line (not normalized) -* `point`:\\[in\\] The coordinates of the point to check -* `tolerance`:\\[in\\] A double > 0 defining the tolerance -# Returns -0 if the point is outside, 1 otherwise. +* `search_with_queries`:\\[in,out\\] the search with queries context to update +* `queries`:\\[in\\] a pointer to an array of queries +* `num_queries`:\\[in\\] the number of queries in the array ### Prototype ```c -int t8_line_point_inside (const double *p_0, const double *vec, const double *point, const double tolerance); +void t8_forest_search_with_queries_update_queries (t8_forest_search_with_queries_c_wrapper search_with_queries, void **queries, const size_t num_queries); ``` """ -function t8_line_point_inside(p_0, vec, point, tolerance) - @ccall libt8.t8_line_point_inside(p_0::Ptr{Cdouble}, vec::Ptr{Cdouble}, point::Ptr{Cdouble}, tolerance::Cdouble)::Cint +function t8_forest_search_with_queries_update_queries(search_with_queries, queries, num_queries) + @ccall libt8.t8_forest_search_with_queries_update_queries(search_with_queries::t8_forest_search_with_queries_c_wrapper, queries::Ptr{Ptr{Cvoid}}, num_queries::Csize_t)::Cvoid end """ - t8_triangle_point_inside(p_0, v, w, point, tolerance) + t8_forest_search_with_queries_destroy(search) -Check if a point is inside of a triangle described by a point *p_0* and two vectors *v* and *w*. +Destroy the search with queries context # Arguments -* `p_0`:\\[in\\] The first vertex of a triangle -* `v`:\\[in\\] The vector from p\\_0 to p\\_1 (second vertex in the triangle) -* `w`:\\[in\\] The vector from p\\_0 to p\\_2 (third vertex in the triangle) -* `point`:\\[in\\] The coordinates of the point to check -* `tolerance`:\\[in\\] A double > 0 defining the tolerance -# Returns -0 if the point is outside, 1 otherwise. +* `search`:\\[in,out\\] the search with queries context to destroy ### Prototype ```c -int t8_triangle_point_inside (const double p_0[3], const double v[3], const double w[3], const double point[3], const double tolerance); +void t8_forest_search_with_queries_destroy (t8_forest_search_with_queries_c_wrapper search); ``` """ -function t8_triangle_point_inside(p_0, v, w, point, tolerance) - @ccall libt8.t8_triangle_point_inside(p_0::Ptr{Cdouble}, v::Ptr{Cdouble}, w::Ptr{Cdouble}, point::Ptr{Cdouble}, tolerance::Cdouble)::Cint +function t8_forest_search_with_queries_destroy(search) + @ccall libt8.t8_forest_search_with_queries_destroy(search::t8_forest_search_with_queries_c_wrapper)::Cvoid end """ - t8_plane_point_inside(point_on_face, face_normal, point) + t8_forest_search_with_queries_do_search(search) -Check if a point lays on the inner side of a plane of a bilinearly interpolated volume element. the plane is described by a point and the normal of the face. +Perform the search with queries # Arguments -* `point_on_face`:\\[in\\] A point on the plane -* `face_normal`:\\[in\\] The normal of the face -* `point`:\\[in\\] The point to check -# Returns -0 if the point is outside, 1 otherwise. +* `search`:\\[in,out\\] the search with queries context to use ### Prototype ```c -int t8_plane_point_inside (const double point_on_face[3], const double face_normal[3], const double point[3]); +void t8_forest_search_with_queries_do_search (t8_forest_search_with_queries_c_wrapper search); ``` """ -function t8_plane_point_inside(point_on_face, face_normal, point) - @ccall libt8.t8_plane_point_inside(point_on_face::Ptr{Cdouble}, face_normal::Ptr{Cdouble}, point::Ptr{Cdouble})::Cint +function t8_forest_search_with_queries_do_search(search) + @ccall libt8.t8_forest_search_with_queries_do_search(search::t8_forest_search_with_queries_c_wrapper)::Cvoid end -""" - t8_cmesh_set_tree_vertices(cmesh, gtree_id, vertices, num_vertices) +mutable struct t8_forest_search_with_batched_queries end -Set the vertex coordinates of a tree in the cmesh. This is currently inefficient, since the vertices are duplicated for each tree. Eventually this function will be replaced by a more efficient one. It is not allowed to call this function after t8_cmesh_commit. The eclass of the tree has to be set before calling this function. +"""A wrapper around the forest search with batched queries context""" +const t8_forest_search_with_batched_queries_c_wrapper = Ptr{t8_forest_search_with_batched_queries} + +""" + t8_forest_init_search_with_batched_queries(search_with_queries, element_callback, queries_callback, queries, num_queries, forest) -# Arguments -* `cmesh`:\\[in,out\\] The cmesh to be updated. -* `gtree_id`:\\[in\\] The global number of the tree. -* `vertices`:\\[in\\] An array of 3 doubles per tree vertex. -* `num_vertices`:\\[in\\] The number of verticess in *vertices*. Must match the number of corners of the tree. ### Prototype ```c -void t8_cmesh_set_tree_vertices (t8_cmesh_t cmesh, const t8_gloidx_t gtree_id, const double *vertices, const int num_vertices); +void t8_forest_init_search_with_batched_queries (t8_forest_search_with_batched_queries_c_wrapper search_with_queries, t8_search_element_callback_c_wrapper element_callback, t8_search_batched_queries_callback_c_wrapper queries_callback, void **queries, const size_t num_queries, const t8_forest_t forest); ``` """ -function t8_cmesh_set_tree_vertices(cmesh, gtree_id, vertices, num_vertices) - @ccall libt8.t8_cmesh_set_tree_vertices(cmesh::t8_cmesh_t, gtree_id::t8_gloidx_t, vertices::Ptr{Cdouble}, num_vertices::Cint)::Cvoid +function t8_forest_init_search_with_batched_queries(search_with_queries, element_callback, queries_callback, queries, num_queries, forest) + @ccall libt8.t8_forest_init_search_with_batched_queries(search_with_queries::t8_forest_search_with_batched_queries_c_wrapper, element_callback::t8_search_element_callback_c_wrapper, queries_callback::t8_search_batched_queries_callback_c_wrapper, queries::Ptr{Ptr{Cvoid}}, num_queries::Csize_t, forest::Cint)::Cvoid end """ - vtk_file_type + t8_forest_search_with_batched_queries_update_forest(search_with_queries, forest) -Enumerator for all types of files readable by t8code. +### Prototype +```c +void t8_forest_search_with_batched_queries_update_forest ( t8_forest_search_with_batched_queries_c_wrapper search_with_queries, const t8_forest_t forest); +``` """ -@cenum vtk_file_type::Int32 begin - VTK_FILE_ERROR = -1 - VTK_SERIAL_FILE = 8 - VTK_UNSTRUCTURED_FILE = 8 - VTK_POLYDATA_FILE = 9 - VTK_PARALLEL_FILE = 16 - VTK_PARALLEL_UNSTRUCTURED_FILE = 16 - VTK_PARALLEL_POLYDATA_FILE = 17 - VTK_NUM_TYPES = 5 -end - -"""Enumerator for all types of files readable by t8code.""" -const vtk_file_type_t = vtk_file_type - -@cenum vtk_read_success::UInt32 begin - read_failure = 0 - read_success = 1 +function t8_forest_search_with_batched_queries_update_forest(search_with_queries, forest) + @ccall libt8.t8_forest_search_with_batched_queries_update_forest(search_with_queries::t8_forest_search_with_batched_queries_c_wrapper, forest::Cint)::Cvoid end -const vtk_read_success_t = vtk_read_success - """ - t8_forest_vtk_write_file_via_API(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, curved_flag, write_ghosts, num_data, data) + t8_forest_search_with_batched_queries_update_user_data(search_with_queries, udata) -Write the forest in .pvtu file format. Writes one .vtu file per process and a meta .pvtu file. This function uses the vtk library. t8code must be configured with "--with-vtk" in order to use it. Currently does not support pyramid elements. - -!!! note - - If t8code was not configured with vtk, use t8_forest_vtk_write_file +Update the user data pointer in the search with batched queries context # Arguments -* `forest`:\\[in\\] The forest. -* `fileprefix`:\\[in\\] The prefix of the output files. The meta file will be named *fileprefix*.pvtu . -* `write_treeid`:\\[in\\] If true, the global tree id is written for each element. -* `write_mpirank`:\\[in\\] If true, the mpirank is written for each element. -* `write_level`:\\[in\\] If true, the refinement level is written for each element. -* `write_element_id`:\\[in\\] If true, the global element id is written for each element. -* `curved_flag`:\\[in\\] If true, write the elements as curved element types from vtk. -* `write_ghosts`:\\[in\\] If true, write out ghost elements as well. -* `num_data`:\\[in\\] Number of user defined double valued data fields to write. -* `data`:\\[in\\] Array of [`t8_vtk_data_field_t`](@ref) of length *num_data* providing the user defined per element data. If scalar and vector fields are used, all scalar fields must come first in the array. -# Returns -True if successful, false if not (process local). +* `search_with_queries`:\\[in,out\\] the search with batched queries context to update +* `udata`:\\[in\\] the new user data pointer to use ### Prototype ```c -int t8_forest_vtk_write_file_via_API (t8_forest_t forest, const char *fileprefix, const int write_treeid, const int write_mpirank, const int write_level, const int write_element_id, const int curved_flag, const int write_ghosts, const int num_data, t8_vtk_data_field_t *data); +void t8_forest_search_with_batched_queries_update_user_data ( t8_forest_search_with_batched_queries_c_wrapper search_with_queries, void *udata); ``` """ -function t8_forest_vtk_write_file_via_API(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, curved_flag, write_ghosts, num_data, data) - @ccall libt8.t8_forest_vtk_write_file_via_API(forest::t8_forest_t, fileprefix::Cstring, write_treeid::Cint, write_mpirank::Cint, write_level::Cint, write_element_id::Cint, curved_flag::Cint, write_ghosts::Cint, num_data::Cint, data::Ptr{t8_vtk_data_field_t})::Cint +function t8_forest_search_with_batched_queries_update_user_data(search_with_queries, udata) + @ccall libt8.t8_forest_search_with_batched_queries_update_user_data(search_with_queries::t8_forest_search_with_batched_queries_c_wrapper, udata::Ptr{Cvoid})::Cvoid end """ - t8_forest_vtk_write_file(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, write_ghosts, num_data, data) + t8_forest_search_with_batched_queries_update_queries(search_with_queries, queries, num_queries) -Write the forest in .pvtu file format. Writes one .vtu file per process and a meta .pvtu file. This function writes ASCII files and can be used when t8code is not configure with "--with-vtk" and t8_forest_vtk_write_file_via_API is not available. +Update the queries in the search with batched queries context # Arguments -* `forest`:\\[in\\] The forest. -* `fileprefix`:\\[in\\] The prefix of the output files. -* `write_treeid`:\\[in\\] If true, the global tree id is written for each element. -* `write_mpirank`:\\[in\\] If true, the mpirank is written for each element. -* `write_level`:\\[in\\] If true, the refinement level is written for each element. -* `write_element_id`:\\[in\\] If true, the global element id is written for each element. -* `write_ghosts`:\\[in\\] If true, each process additionally writes its ghost elements. For ghost element the treeid is -1. -* `num_data`:\\[in\\] Number of user defined double valued data fields to write. -* `data`:\\[in\\] Array of [`t8_vtk_data_field_t`](@ref) of length *num_data* providing the used defined per element data. If scalar and vector fields are used, all scalar fields must come first in the array. -# Returns -True if successful, false if not (process local). +* `search_with_queries`:\\[in,out\\] the search with batched queries context to update +* `queries`:\\[in\\] a pointer to an array of queries +* `num_queries`:\\[in\\] the number of queries in the array ### Prototype ```c -int t8_forest_vtk_write_file (t8_forest_t forest, const char *fileprefix, const int write_treeid, const int write_mpirank, const int write_level, const int write_element_id, int write_ghosts, const int num_data, t8_vtk_data_field_t *data); +void t8_forest_search_with_batched_queries_update_queries ( t8_forest_search_with_batched_queries_c_wrapper search_with_queries, void **queries, const size_t num_queries); ``` """ -function t8_forest_vtk_write_file(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, write_ghosts, num_data, data) - @ccall libt8.t8_forest_vtk_write_file(forest::t8_forest_t, fileprefix::Cstring, write_treeid::Cint, write_mpirank::Cint, write_level::Cint, write_element_id::Cint, write_ghosts::Cint, num_data::Cint, data::Ptr{t8_vtk_data_field_t})::Cint +function t8_forest_search_with_batched_queries_update_queries(search_with_queries, queries, num_queries) + @ccall libt8.t8_forest_search_with_batched_queries_update_queries(search_with_queries::t8_forest_search_with_batched_queries_c_wrapper, queries::Ptr{Ptr{Cvoid}}, num_queries::Csize_t)::Cvoid end """ - t8_cmesh_vtk_write_file_via_API(cmesh, fileprefix, comm) + t8_forest_search_with_batched_queries_destroy(search) + +Destroy the search with batched queries context +# Arguments +* `search`:\\[in,out\\] the search with batched queries context to destroy ### Prototype ```c -int t8_cmesh_vtk_write_file_via_API (t8_cmesh_t cmesh, const char *fileprefix, sc_MPI_Comm comm); +void t8_forest_search_with_batched_queries_destroy (t8_forest_search_with_batched_queries_c_wrapper search); ``` """ -function t8_cmesh_vtk_write_file_via_API(cmesh, fileprefix, comm) - @ccall libt8.t8_cmesh_vtk_write_file_via_API(cmesh::t8_cmesh_t, fileprefix::Cstring, comm::MPI_Comm)::Cint +function t8_forest_search_with_batched_queries_destroy(search) + @ccall libt8.t8_forest_search_with_batched_queries_destroy(search::t8_forest_search_with_batched_queries_c_wrapper)::Cvoid end """ - t8_cmesh_vtk_write_file(cmesh, fileprefix) + t8_forest_search_with_batched_queries_do_search(search) -Write the cmesh in .pvtu file format. Writes one .vtu file per process and a meta .pvtu file. This function writes ASCII files and can be used when t8code is not configure with "--with-vtk" and t8_cmesh_vtk_write_file_via_API is not available. +Perform the search with batched queries # Arguments -* `cmesh`:\\[in\\] The cmesh -* `fileprefix`:\\[in\\] The prefix of the output files -# Returns -int +* `search`:\\[in,out\\] the search with batched queries context to use ### Prototype ```c -int t8_cmesh_vtk_write_file (t8_cmesh_t cmesh, const char *fileprefix); +void t8_forest_search_with_batched_queries_do_search (t8_forest_search_with_batched_queries_c_wrapper search); ``` """ -function t8_cmesh_vtk_write_file(cmesh, fileprefix) - @ccall libt8.t8_cmesh_vtk_write_file(cmesh::t8_cmesh_t, fileprefix::Cstring)::Cint +function t8_forest_search_with_batched_queries_do_search(search) + @ccall libt8.t8_forest_search_with_batched_queries_do_search(search::t8_forest_search_with_batched_queries_c_wrapper)::Cvoid end # typedef void ( * t8_geom_analytic_fn ) ( t8_cmesh_t cmesh , t8_gloidx_t gtreeid , const double * ref_coords , const size_t num_coords , double * out_coords , const void * tree_data , const void * user_data ) @@ -17707,7 +16645,7 @@ end Definition of an analytic geometry function. This function maps reference coordinates to physical coordinates. ```c++ - [0,1]^\\mathrm{dim} + [0,1]^\\mathrm{dim} ``` . @@ -17716,7 +16654,7 @@ Definition of an analytic geometry function. This function maps reference coordi * `cmesh`:\\[in\\] The cmesh. * `gtreeid`:\\[in\\] The global tree (of the cmesh) in which the reference point is. * `ref_coords`:\\[in\\] Array of dimension x *num_coords* many entries, specifying a point in -* `num_coords`:\\[in\\] +* `num_coords`:\\[in\\] The number of coordinates in *ref_coords*. * `out_coords`:\\[out\\] The mapped coordinates in physical space of *ref_coords*. The length is *num_coords* * 3. * `tree_data`:\\[in\\] The data of the current tree as loaded by a t8_geom_load_tree_data_fn. * `user_data`:\\[in\\] The user data pointer stored in the geometry. @@ -17728,19 +16666,19 @@ const t8_geom_analytic_fn = Ptr{Cvoid} Definition for the jacobian of an analytic geometry function. ```c++ - [0,1]^\\mathrm{dim} + [0,1]^\\mathrm{dim} ``` . ```c++ - \\mathrm{dim} + \\mathrm{dim} ``` to map. ```c++ - \\mathrm{dim} \\cdot 3 + \\mathrm{dim} \\cdot 3 ``` x *num_coords*. Indices @@ -17752,31 +16690,31 @@ x *num_coords*. Indices , ```c++ - 3 \\cdot i+1 + 3 \\cdot i+1 ``` , ```c++ - 3 \\cdot i+2 + 3 \\cdot i+2 ``` correspond to the ```c++ - i + i ``` -th column of the jacobian (Entry ```c++ - 3 \\cdot i + j + 3 \\cdot i + j ``` is ```c++ - \\frac{\\partial f_j}{\\partial x_i} + \\frac{\\partial f_j}{\\partial x_i} ``` ). @@ -17814,37 +16752,59 @@ const t8_geom_tree_compatible_fn = Ptr{Cvoid} """ t8_geometry_analytic_destroy(geom) +Destroy a geometry analytic object. + +# Arguments +* `geom`:\\[in,out\\] A pointer to a geometry object. Set to NULL on output. ### Prototype ```c void t8_geometry_analytic_destroy (t8_geometry_c **geom); ``` """ function t8_geometry_analytic_destroy(geom) - @ccall libt8.t8_geometry_analytic_destroy(geom::Ptr{Ptr{Cint}})::Cvoid + @ccall libt8.t8_geometry_analytic_destroy(geom::Ptr{Ptr{t8_geometry_c}})::Cvoid end """ t8_geometry_analytic_new(name, analytical, jacobian, load_tree_data, tree_negative_volume, tree_compatible, user_data) +Create a new analytic geometry. The geometry is viable with all tree types and uses a user-provided analytic and jacobian function. The actual mappings are done by these functions. + +# Arguments +* `name`:\\[in\\] The name to give this geometry. +* `analytical`:\\[in\\] The analytical function to use for this geometry. +* `jacobian`:\\[in\\] The jacobian of *analytical*. +* `load_tree_data`:\\[in\\] The function that is used to load a tree's data. +* `tree_negative_volume`:\\[in\\] The function that is used to compute if a trees volume is negative. +* `tree_compatible`:\\[in\\] The function that is used to check if a tree is compatible with the geometry. +* `user_data`:\\[in\\] Additional user data which the geometry can use. +# Returns +A pointer to an allocated geometry struct. ### Prototype ```c t8_geometry_c * t8_geometry_analytic_new (const char *name, t8_geom_analytic_fn analytical, t8_geom_analytic_jacobian_fn jacobian, t8_geom_load_tree_data_fn load_tree_data, t8_geom_tree_negative_volume_fn tree_negative_volume, t8_geom_tree_compatible_fn tree_compatible, const void *user_data); ``` """ function t8_geometry_analytic_new(name, analytical, jacobian, load_tree_data, tree_negative_volume, tree_compatible, user_data) - @ccall libt8.t8_geometry_analytic_new(name::Cstring, analytical::t8_geom_analytic_fn, jacobian::t8_geom_analytic_jacobian_fn, load_tree_data::t8_geom_load_tree_data_fn, tree_negative_volume::t8_geom_tree_negative_volume_fn, tree_compatible::t8_geom_tree_compatible_fn, user_data::Ptr{Cvoid})::Ptr{Cint} + @ccall libt8.t8_geometry_analytic_new(name::Cstring, analytical::t8_geom_analytic_fn, jacobian::t8_geom_analytic_jacobian_fn, load_tree_data::t8_geom_load_tree_data_fn, tree_negative_volume::t8_geom_tree_negative_volume_fn, tree_compatible::t8_geom_tree_compatible_fn, user_data::Ptr{Cvoid})::Ptr{t8_geometry_c} end """ t8_geom_load_tree_data_vertices(cmesh, gtreeid, user_data) +Load vertex data from given tree. + +# Arguments +* `cmesh`:\\[in\\] The cmesh. +* `gtreeid`:\\[in\\] The global tree id (in the cmesh). +* `user_data`:\\[out\\] The load tree vertices. ### Prototype ```c void t8_geom_load_tree_data_vertices (t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const void **user_data); ``` """ function t8_geom_load_tree_data_vertices(cmesh, gtreeid, user_data) - @ccall libt8.t8_geom_load_tree_data_vertices(cmesh::t8_cmesh_t, gtreeid::Cint, user_data::Ptr{Ptr{Cvoid}})::Cvoid + @ccall libt8.t8_geom_load_tree_data_vertices(cmesh::t8_cmesh_t, gtreeid::t8_gloidx_t, user_data::Ptr{Ptr{Cvoid}})::Cvoid end """ @@ -18098,42 +17058,34 @@ function t8_geometry_zero_destroy(geom) end """ - t8_scheme_new_default_cxx() - -Return the default element implementation of t8code. + t8_scheme_new_default() ### Prototype ```c -t8_scheme_cxx_t * t8_scheme_new_default_cxx (void); +const t8_scheme_c * t8_scheme_new_default (void); ``` """ -function t8_scheme_new_default_cxx() - @ccall libt8.t8_scheme_new_default_cxx()::Ptr{t8_scheme_cxx_t} +function t8_scheme_new_default() + @ccall libt8.t8_scheme_new_default()::Ptr{Cint} end """ - t8_eclass_scheme_is_default(ts) + t8_eclass_scheme_is_default(scheme, eclass) -Check whether a given eclass\\_scheme is one of the default schemes. - -# Arguments -* `ts`:\\[in\\] A (pointer to a) scheme -# Returns -True (non-zero) if *ts* is one of the default schemes, false (zero) otherwise. ### Prototype ```c -int t8_eclass_scheme_is_default (t8_eclass_scheme_c *ts); +int t8_eclass_scheme_is_default (const t8_scheme_c *scheme, const t8_eclass_t eclass); ``` """ -function t8_eclass_scheme_is_default(ts) - @ccall libt8.t8_eclass_scheme_is_default(ts::Ptr{t8_eclass_scheme_c})::Cint +function t8_eclass_scheme_is_default(scheme, eclass) + @ccall libt8.t8_eclass_scheme_is_default(scheme::Ptr{Cint}, eclass::t8_eclass_t)::Cint end -const SC_CC = "/opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/bin/mpicc" +const SC_CC = "/opt/bin/x86_64-linux-gnu-libgfortran5-cxx11-mpi+mpich/x86_64-linux-gnu-gcc" const SC_CFLAGS = " " -const SC_CPP = "/opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/bin/mpicc -E" +const SC_CPP = "/opt/bin/x86_64-linux-gnu-libgfortran5-cxx11-mpi+mpich/x86_64-linux-gnu-gcc -E" const SC_CPPFLAGS = "" @@ -18149,6 +17101,14 @@ const SC_ENABLE_MPICOMMSHARED = 1 const SC_ENABLE_MPIIO = 1 +const SC_HAVE_AINT_DIFF = 1 + +const SC_HAVE_MPI_UNSIGNED_LONG_LONG = 1 + +const SC_HAVE_MPI_SIGNED_CHAR = 1 + +const SC_HAVE_MPI_INT8_T = 1 + const SC_ENABLE_MPITHREAD = 1 const SC_ENABLE_MPIWINSHARED = 1 @@ -18159,12 +17119,16 @@ const SC_ENABLE_USE_REALLOC = 1 const SC_ENABLE_V4L2 = 1 +const SC_HAVE_ALIGNED_ALLOC = 1 + const SC_HAVE_BACKTRACE = 1 const SC_HAVE_BACKTRACE_SYMBOLS = 1 const SC_HAVE_FSYNC = 1 +const SC_HAVE_POSIX_MEMALIGN = 1 + const SC_HAVE_FABS = 1 const SC_HAVE_QSORT_R = 1 @@ -18203,11 +17167,9 @@ const SC_SIZEOF_UNSIGNED_INT = 4 const SC_SIZEOF_LONG = 8 -const SC_SIZEOF_LONG_LONG = 8 - const SC_SIZEOF_UNSIGNED_LONG = 8 -const SC_SIZEOF_UNSIGNED_LONG_LONG = 8 +const SC_SIZEOF_LONG_LONG = 8 const SC_VERSION = "0.0.0" @@ -18215,103 +17177,161 @@ const SC_VERSION_MAJOR = 0 const SC_VERSION_MINOR = 0 +const SC_VERSION_POINT = 0 + +# Skipping MacroDefinition: _sc_const const + +const sc_MPI_ERR_ARG = MPI_ERR_ARG +const sc_MPI_ERR_COUNT = MPI_ERR_COUNT +const sc_MPI_ERR_UNKNOWN = MPI_ERR_UNKNOWN +const sc_MPI_ERR_NO_MEM = MPI_ERR_NO_MEM +const sc_MPI_MAX_ERROR_STRING = MPI_MAX_ERROR_STRING +const sc_MPI_ERR_FILE = MPI_ERR_FILE +const sc_MPI_ERR_NOT_SAME = MPI_ERR_NOT_SAME +const sc_MPI_ERR_AMODE = MPI_ERR_AMODE +const sc_MPI_ERR_UNSUPPORTED_DATAREP = MPI_ERR_UNSUPPORTED_DATAREP +const sc_MPI_ERR_UNSUPPORTED_OPERATION = MPI_ERR_UNSUPPORTED_OPERATION +const sc_MPI_ERR_NO_SUCH_FILE = MPI_ERR_NO_SUCH_FILE +const sc_MPI_ERR_FILE_EXISTS = MPI_ERR_FILE_EXISTS +const sc_MPI_ERR_BAD_FILE = MPI_ERR_BAD_FILE +const sc_MPI_ERR_ACCESS = MPI_ERR_ACCESS +const sc_MPI_ERR_NO_SPACE = MPI_ERR_NO_SPACE +const sc_MPI_ERR_QUOTA = MPI_ERR_QUOTA +const sc_MPI_ERR_READ_ONLY = MPI_ERR_READ_ONLY +const sc_MPI_ERR_FILE_IN_USE = MPI_ERR_FILE_IN_USE +const sc_MPI_ERR_DUP_DATAREP = MPI_ERR_DUP_DATAREP +const sc_MPI_ERR_CONVERSION = MPI_ERR_CONVERSION +const sc_MPI_ERR_IO = MPI_ERR_IO +const sc_MPI_ERR_LASTCODE = MPI_ERR_LASTCODE +const sc_MPI_Aint = MPI_Aint +const sc_MPI_COMM_WORLD = MPI_COMM_WORLD -const sc_MPI_COMM_WORLD = MPI.COMM_WORLD +const sc_MPI_COMM_SELF = MPI_COMM_SELF -const sc_MPI_COMM_SELF = MPI.COMM_SELF +const sc_MPI_BYTE = MPI_BYTE -const sc_MPI_CHAR = MPI.CHAR +const sc_MPI_CHAR = MPI_CHAR -const sc_MPI_SIGNED_CHAR = MPI.SIGNED_CHAR +const sc_MPI_UNSIGNED_CHAR = MPI_UNSIGNED_CHAR -const sc_MPI_UNSIGNED_CHAR = MPI.UNSIGNED_CHAR +const sc_MPI_SHORT = MPI_SHORT -const sc_MPI_BYTE = MPI.BYTE +const sc_MPI_UNSIGNED_SHORT = MPI_UNSIGNED_SHORT -const sc_MPI_SHORT = MPI.SHORT +const sc_MPI_INT = MPI_INT -const sc_MPI_UNSIGNED_SHORT = MPI.UNSIGNED_SHORT +const sc_MPI_UNSIGNED = MPI_UNSIGNED -const sc_MPI_INT = MPI.INT +const sc_MPI_LONG = MPI_LONG -const sc_MPI_INT8_T = MPI.INT8_T +const sc_MPI_UNSIGNED_LONG = MPI_UNSIGNED_LONG -const sc_MPI_UNSIGNED = MPI.UNSIGNED +const sc_MPI_UNSIGNED_LONG_LONG = MPI_UNSIGNED_LONG_LONG -const sc_MPI_LONG = MPI.LONG +const sc_MPI_SIGNED_CHAR = MPI_SIGNED_CHAR -const sc_MPI_UNSIGNED_LONG = MPI.UNSIGNED_LONG +const sc_MPI_INT8_T = MPI_INT8_T -const sc_MPI_LONG_LONG_INT = MPI.LONG_LONG_INT +const sc_MPI_LONG_LONG_INT = MPI_LONG_LONG_INT -const sc_MPI_UNSIGNED_LONG_LONG = MPI.UNSIGNED_LONG_LONG +const sc_MPI_FLOAT = MPI_FLOAT -const sc_MPI_FLOAT = MPI.FLOAT +const sc_MPI_DOUBLE = MPI_DOUBLE -const sc_MPI_DOUBLE = MPI.DOUBLE +const sc_MPI_DOUBLE_INT = MPI_DOUBLE_INT +const sc_MPI_PACKED = MPI_PACKED -const sc_MPI_Comm = MPI.Comm +const sc_MPI_Comm = MPI_Comm -const sc_MPI_Group = MPI.Group +const sc_MPI_Group = MPI_Group -const sc_MPI_Datatype = MPI.Datatype +const sc_MPI_Datatype = MPI_Datatype -const sc_MPI_Info = MPI.Info +const sc_MPI_Info = MPI_Info +const sc_MPI_Type_size = MPI_Type_size +const sc_MPI_Pack = MPI_Pack +const sc_MPI_Unpack = MPI_Unpack +const sc_MPI_Pack_size = MPI_Pack_size +const sc_MPI_Aint_diff = MPI_Aint_diff +const sc_MPI_MODE_RDONLY = MPI_MODE_RDONLY +const sc_MPI_MODE_RDWR = MPI_MODE_RDWR +const sc_MPI_MODE_WRONLY = MPI_MODE_WRONLY +const sc_MPI_MODE_CREATE = MPI_MODE_CREATE +const sc_MPI_MODE_EXCL = MPI_MODE_EXCL +const sc_MPI_MODE_DELETE_ON_CLOSE = MPI_MODE_DELETE_ON_CLOSE +const sc_MPI_MODE_UNIQUE_OPEN = MPI_MODE_UNIQUE_OPEN +const sc_MPI_MODE_SEQUENTIAL = MPI_MODE_SEQUENTIAL +const sc_MPI_MODE_APPEND = MPI_MODE_APPEND +const sc_MPI_SEEK_SET = MPI_SEEK_SET +const sc_MPI_SEEK_CUR = MPI_SEEK_CUR +const sc_MPI_SEEK_END = MPI_SEEK_END -const sc_MPI_File = MPI.File +const sc_MPI_Offset = MPI_Offset -const sc_MPI_FILE_NULL = MPI.FILE_NULL +const sc_MPI_File = MPI_File +const sc_MPI_FILE_NULL = MPI_FILE_NULL +const sc_MPI_File_open = MPI_File_open +const sc_MPI_File_close = MPI_File_close +const sc_MPI_File_get_view = MPI_File_get_view +const sc_MPI_File_set_view = MPI_File_set_view +const sc_MPI_File_write_all = MPI_File_write_all +const sc_MPI_File_read_all = MPI_File_read_all +const sc_MPI_File_write_at_all = MPI_File_write_at_all +const sc_MPI_File_read_at_all = MPI_File_read_at_all +const sc_MPI_File_get_size = MPI_File_get_size + +const sc_MPI_File_set_size = MPI_File_set_size const SC_EPS = 2.220446049250313e-16 @@ -18345,7 +17365,9 @@ const SC_LP_SILENT = 9 const SC_LP_THRESHOLD = SC_LP_INFO +const t8_const = _sc_const +const t8_restrict = _sc_restrict const T8_MPI_LOCIDX = sc_MPI_INT @@ -18353,6 +17375,8 @@ const T8_LOCIDX_MAX = INT32_MAX const T8_MPI_GLOIDX = sc_MPI_LONG_LONG_INT +const T8_GLOIDX_MAX = INT64_MAX + const T8_MPI_LINEARIDX = sc_MPI_UNSIGNED_LONG_LONG # Skipping MacroDefinition: T8_PADDING_SIZE ( sizeof ( void * ) ) @@ -18361,8 +17385,6 @@ const T8_PRECISION_EPS = SC_EPS const T8_PRECISION_SQRT_EPS = sqrt(T8_PRECISION_EPS) -const T8_CMESH_N_SUPPORTED_MSH_FILE_VERSIONS = 2 - # Skipping MacroDefinition: T8_MPI_ECLASS_TYPE ( T8_ASSERT ( sizeof ( int ) == sizeof ( t8_eclass_t ) ) , sc_MPI_INT ) const T8_ECLASS_MAX_FACES = 6 @@ -18377,12 +17399,61 @@ const T8_ECLASS_MAX_CORNERS = 8 const T8_ECLASS_MAX_DIM = 3 +const T8_ECLASS_TO_DIMENSION_VALUES = {0, 1, 2, 2, 3, 3, 3, 3} + +const T8_ECLASS_NUM_FACES_VALUES = {0, 2, 4, 3, 6, 4, 5, 5} + +const T8_ECLASS_MAX_NUM_FACES_VALUES = {0, 2, 4, 6} + +const T8_ECLASS_MAX_NUM_CHILDREN_VALUES = {1, 2, 4, 4, 8, 8, 8, 10} + +# Skipping MacroDefinition: T8_FACE_VERTEX_TO_TREE_VERTEX_VALUES { { { - 1 } } , /* vertex */ { { 0 } , { 1 } } , /* line */ { { 0 , 2 } , { 1 , 3 } , { 0 , 1 } , { 2 , 3 } } , /* quad */ { { 1 , 2 } , { 0 , 2 } , { 0 , 1 } } , /* triangle */ { { 0 , 2 , 4 , 6 } , { 1 , 3 , 5 , 7 } , { 0 , 1 , 4 , 5 } , { 2 , 3 , 6 , 7 } , { 0 , 1 , 2 , 3 } , { 4 , 5 , 6 , 7 } } , /* hex */ { { 1 , 2 , 3 } , { 0 , 2 , 3 } , { 0 , 1 , 3 } , { 0 , 1 , 2 } } , /* tet */ { { 1 , 2 , 4 , 5 } , { 0 , 2 , 3 , 5 } , { 0 , 1 , 3 , 4 } , { 0 , 1 , 2 } , { 3 , 4 , 5 } } , /* prism */ { { 0 , 2 , 4 } , { 1 , 3 , 4 } , { 0 , 1 , 4 } , { 2 , 3 , 4 } , { 0 , 1 , 2 , 3 } } /* pyramid */ \ +#} + +# Skipping MacroDefinition: T8_FACE_EDGE_TO_TREE_EDGE_VALUES { { { - 1 } } , /* vertex */ { { 0 } } , /* line */ { { 0 } , { 1 } , { 2 } , { 3 } } , /* quad */ { { 0 } , { 1 } , { 2 } } , /* triangle */ { { 8 , 10 , 4 , 6 } , { 9 , 11 , 5 , 7 } , { 8 , 9 , 0 , 2 } , { 10 , 11 , 1 , 3 } , { 4 , 5 , 0 , 1 } , { 6 , 7 , 2 , 3 } } , /* hex */ { { 3 , 4 , 5 } , { 1 , 2 , 5 } , { 0 , 2 , 4 } , { 0 , 1 , 3 } } , /* tet */ { { 0 , 7 , 3 , 6 } , { 1 , 8 , 4 , 7 } , { 2 , 6 , 5 , 8 } , { 0 , 1 , 2 } , { 3 , 4 , 5 } } , /* prism */ { { - 1 } } , /* pyramid */ \ +#} + +# Skipping MacroDefinition: T8_FACE_TO_EDGE_NEIGHBOR_VALUES { { { - 1 } } , /* vertex */ { { - 1 } } , /* line */ { { 2 , 3 } , { 2 , 3 } , { 0 , 1 } , { 0 , 1 } } , /* quad */ { { 2 , 1 } , { 2 , 0 } , { 1 , 0 } } , /* triangle */ { { 0 , 1 , 2 , 3 } , { 0 , 1 , 2 , 3 } , { 4 , 5 , 6 , 7 } , { 4 , 5 , 6 , 7 } , { 8 , 9 , 10 , 11 } , { 8 , 9 , 10 , 11 } } , /* hex */ { { 0 , 1 , 2 } , { 0 , 3 , 4 } , { 1 , 3 , 5 } , { 2 , 4 , 5 } } , /* tet */ { { 1 , 2 , 4 , 5 } , { 0 , 2 , 3 , 5 } , { 0 , 1 , 3 , 4 } , { 6 , 7 , 8 } , { 6 , 7 , 8 } } , /* prism */ { { - 1 } } , /* pyramid */ \ +#} + +# Skipping MacroDefinition: T8_EDGE_VERTEX_TO_TREE_VERTEX_VALUES { { { - 1 } } , /* vertex */ { { 0 } , { 1 } } , /* line */ { { 0 , 2 } , { 1 , 3 } , { 0 , 1 } , { 2 , 3 } } , /* quad */ { { 1 , 2 } , { 0 , 2 } , { 0 , 1 } } , /* triangle */ { { 0 , 1 } , { 2 , 3 } , { 4 , 5 } , { 6 , 7 } , { 0 , 2 } , { 1 , 3 } , { 4 , 6 } , { 5 , 7 } , { 0 , 4 } , { 1 , 5 } , { 2 , 6 } , { 3 , 7 } } , /* hex */ { { 0 , 1 } , { 0 , 2 } , { 0 , 3 } , { 1 , 2 } , { 1 , 3 } , { 2 , 3 } } , /* tet */ { { 1 , 2 } , { 0 , 2 } , { 0 , 1 } , { 4 , 5 } , { 3 , 5 } , { 3 , 4 } , { 1 , 4 } , { 2 , 5 } , { 0 , 3 } } , /* prism */ { { - 1 } } , /* pyramid */ \ +#} + +# Skipping MacroDefinition: T8_EDGE_TO_FACE_VALUES { { { - 1 } } , /* vertex */ { { 0 } } , /* line */ { { 0 } , { 1 } , { 2 } , { 3 } } , /* quad */ { { 0 } , { 1 } , { 2 } } , /* triangle */ { { 2 , 4 } , { 3 , 4 } , { 2 , 5 } , { 3 , 5 } , { 0 , 4 } , { 1 , 4 } , { 0 , 5 } , { 1 , 5 } , { 0 , 2 } , { 1 , 2 } , { 0 , 3 } , { 1 , 3 } } , /* hex */ { { 2 , 3 } , { 1 , 3 } , { 1 , 2 } , { 0 , 3 } , { 0 , 2 } , { 0 , 1 } } , /* tet */ { { 0 , 3 } , { 1 , 3 } , { 2 , 3 } , { 0 , 4 } , { 1 , 4 } , { 2 , 4 } , { 0 , 2 } , { 0 , 1 } , { 1 , 2 } } , /* prism */ { { - 1 } } , /* pyramid */ \ +#} + +# Skipping MacroDefinition: T8_ECLASS_FACE_ORIENTATION_VALUES { { 0 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* vertex */ { 0 , 0 , - 1 , - 1 , - 1 , - 1 } , /* line */ { 0 , 0 , 0 , 0 , - 1 , - 1 } , /* quad */ { 0 , 0 , 0 , - 1 , - 1 , - 1 } , /* triangle */ { 0 , 1 , 1 , 0 , 0 , 1 } , /* hex */ { 0 , 1 , 0 , 1 , - 1 , - 1 } , /* tet */ { 1 , 0 , 1 , 0 , 1 , - 1 } , /* prism */ { 0 , 1 , 1 , 0 , 0 , - 1 } /* pyramid */ \ +#} + +const T8_REFERENCE_FACE_NORMAL_TET_VALUES = {{-1, 0, 0}, {1, 0, -1}, {0, -1, 1}, {0, 1, 0}} + +const T8_ECLASS_NUM_VERTICES_VALUES = {1, 2, 4, 3, 8, 4, 6, 5} + +const T8_ECLASS_NUM_EDGES_VALUES = {0, 1, 4, 3, 12, 6, 9, 8} + +const T8_ECLASS_VTK_TYPE_VALUES = {1, 3, 9, 5, 12, 10, 13, 14} + +# Skipping MacroDefinition: T8_ECLASS_VTK_TO_T8_CORNER_NUMBER_VALUES { { 0 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* vertex */ { 0 , 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* line */ { 0 , 1 , 3 , 2 , - 1 , - 1 , - 1 , - 1 } , /* quad */ { 0 , 1 , 2 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* triangle */ { 0 , 1 , 3 , 2 , 4 , 5 , 7 , 6 } , /* hex */ { 0 , 2 , 1 , 3 , - 1 , - 1 , - 1 , - 1 } , /* tet */ { 0 , 2 , 1 , 3 , 5 , 4 , - 1 , - 1 } , /* prism */ { 0 , 1 , 3 , 2 , 4 , - 1 , - 1 , - 1 } /* pyramid */ \ +#} + +# Skipping MacroDefinition: T8_ECLASS_T8_TO_VTK_CORNER_NUMBER_VALUES { { 0 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* vertex */ { 0 , 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* line */ { 0 , 1 , 3 , 2 , - 1 , - 1 , - 1 , - 1 } , /* quad */ { 0 , 1 , 2 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* triangle */ { 0 , 1 , 3 , 2 , 4 , 5 , 7 , 6 } , /* hex */ { 0 , 2 , 1 , 3 , - 1 , - 1 , - 1 , - 1 } , /* tet */ { 0 , 2 , 1 , 3 , 5 , 4 , - 1 , - 1 } , /* prism */ { 0 , 1 , 3 , 2 , 4 , - 1 , - 1 , - 1 } /* pyramid */ \ +#} + +# Skipping MacroDefinition: T8_ECLASS_FACE_TYPES_VALUES { { - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* vertex */ { 0 , 0 , - 1 , - 1 , - 1 , - 1 } , /* line */ { 1 , 1 , 1 , 1 , - 1 , - 1 } , /* quad */ { 1 , 1 , 1 , - 1 , - 1 , - 1 } , /* triangle */ { 2 , 2 , 2 , 2 , 2 , 2 } , /* hex */ { 3 , 3 , 3 , 3 , - 1 , - 1 } , /* tet */ { 2 , 2 , 2 , 3 , 3 , - 1 } , /* prism */ { 3 , 3 , 3 , 3 , 2 , - 1 } /* pyramid */ \ +#} + +# Skipping MacroDefinition: T8_ECLASS_BOUNDARY_COUNT_VALUES { { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , /* vertex */ { 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , /* line */ { 4 , 4 , 0 , 0 , 0 , 0 , 0 , 0 } , /* quad */ { 3 , 3 , 0 , 0 , 0 , 0 , 0 , 0 } , /* triangle */ { 8 , 12 , 6 , 0 , 0 , 0 , 0 , 0 } , /* hex */ { 4 , 6 , 0 , 4 , 0 , 0 , 0 , 0 } , /* tet */ { 6 , 9 , 3 , 2 , 0 , 0 , 0 , 0 } , /* prism */ { 5 , 8 , 1 , 4 , 0 , 0 , 0 , 0 } /* pyramid */ \ +#} + +const T8_ECLASS_TO_STRING_VALUES = {"Vertex", "Line", "Quad", "Triangle", "Hex", "Tet", "Prism", "Pyramid", "Invalid"} + # Skipping MacroDefinition: T8_MPI_ELEMENT_SHAPE_TYPE ( T8_ASSERT ( sizeof ( int ) == sizeof ( t8_element_shape_t ) ) , sc_MPI_INT ) const T8_ELEMENT_SHAPE_MAX_FACES = 6 const T8_ELEMENT_SHAPE_MAX_CORNERS = 8 +const T8_VERSION_POINT_STRING = T8_STRINGIFY_MIDDLE(T8_VERSION_POINT) const T8_VTK_LOCIDX = "Int32" @@ -18416,6 +17487,8 @@ const P4EST_ENABLE_MEMALIGN = 1 const P4EST_ENABLE_MPI = 1 +const P4EST_ENABLE_FILE_CHECKS = 1 + const P4EST_ENABLE_MPICOMMSHARED = 1 const P4EST_ENABLE_MPIIO = 1 @@ -18430,6 +17503,8 @@ const P4EST_ENABLE_VTK_COMPRESSION = 1 const P4EST_HAVE_FSYNC = 1 +const P4EST_HAVE_POSIX_MEMALIGN = 1 + const P4EST_HAVE_ZLIB = 1 const P4EST_LDFLAGS = "-Wl,-rpath -Wl,/workspace/destdir/lib -Wl,--enable-new-dtags -L/workspace/x86_64-linux-gnu-libgfortran5-cxx11-mpi+mpich/destdir/lib" @@ -18456,6 +17531,7 @@ const P4EST_VERSION_MAJOR = 0 const P4EST_VERSION_MINOR = 0 +const P4EST_VERSION_POINT = 0 const p4est_qcoord_compare = sc_int32_compare @@ -18465,6 +17541,7 @@ const P4EST_MPI_QCOORD = sc_MPI_INT const P4EST_VTK_QCOORD = "Int32" +const P4EST_F90_QCOORD = INTEGER(KIND = C_INT32_T) const P4EST_QCOORD_MIN = INT32_MIN @@ -18480,6 +17557,7 @@ const P4EST_MPI_TOPIDX = sc_MPI_INT const P4EST_VTK_TOPIDX = "Int32" +const P4EST_F90_TOPIDX = INTEGER(KIND = C_INT32_T) const P4EST_TOPIDX_MIN = INT32_MIN @@ -18497,6 +17575,7 @@ const P4EST_MPI_LOCIDX = sc_MPI_INT const P4EST_VTK_LOCIDX = "Int32" +const P4EST_F90_LOCIDX = INTEGER(KIND = C_INT32_T) const P4EST_LOCIDX_MIN = INT32_MIN @@ -18512,6 +17591,7 @@ const P4EST_MPI_GLOIDX = sc_MPI_LONG_LONG_INT const P4EST_VTK_GLOIDX = "Int64" +const P4EST_F90_GLOIDX = INTEGER(KIND = C_INT64_T) const P4EST_GLOIDX_MIN = INT64_MIN @@ -18519,9 +17599,13 @@ const P4EST_GLOIDX_MAX = INT64_MAX const P4EST_GLOIDX_1 = p4est_gloidx_t(1) +const P4EST_GLOBAL_NOTICE = P4EST_GLOBAL_STATISTICS +const P4EST_GLOBAL_NOTICEF = P4EST_GLOBAL_STATISTICSF +const P4EST_NOTICE = P4EST_STATISTICS +const P4EST_NOTICEF = P4EST_STATISTICSF const P4EST_DIM = 2 @@ -18557,26 +17641,6 @@ const P8EST_STRING = "p8est" const P8EST_ONDISK_FORMAT = 0x03000009 -const T8_CMESH_FORMAT = 0x0002 - -const T8_CMESH_VERTICES_ATTRIBUTE_KEY = 0 - -const T8_CMESH_GEOMETRY_ATTRIBUTE_KEY = 1 - -const T8_CMESH_CAD_EDGE_ATTRIBUTE_KEY = 2 - -const T8_CMESH_CAD_EDGE_PARAMETERS_ATTRIBUTE_KEY = 3 - -const T8_CMESH_CAD_FACE_ATTRIBUTE_KEY = T8_CMESH_CAD_EDGE_PARAMETERS_ATTRIBUTE_KEY + T8_ECLASS_MAX_EDGES - -const T8_CMESH_CAD_FACE_PARAMETERS_ATTRIBUTE_KEY = T8_CMESH_CAD_FACE_ATTRIBUTE_KEY + 1 - -const T8_CMESH_LAGRANGE_POLY_DEGREE_KEY = T8_CMESH_CAD_FACE_PARAMETERS_ATTRIBUTE_KEY + T8_ECLASS_MAX_FACES - -const T8_CMESH_NEXT_POSSIBLE_KEY = T8_CMESH_LAGRANGE_POLY_DEGREE_KEY + 1 - -const T8_CPROFILE_NUM_STATS = 11 - const T8_SHMEM_BEST_TYPE = SC_SHMEM_WINDOW const T8_FOREST_FROM_FIRST = 0 @@ -18597,7 +17661,11 @@ const T8_FOREST_BALANCE_REPART = 1 const T8_FOREST_BALANCE_NO_REPART = 2 -const T8_PROFILE_NUM_STATS = 14 +const T8_PROFILE_NUM_STATS = 17 + +const T8_CMESH_N_SUPPORTED_MSH_FILE_VERSIONS = 2 + +const T8_CMESH_FORMAT = 0x0002 From 50669d6f5a8e89c0f85d7cfd9857a039f43a59b7 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Thu, 11 Dec 2025 10:56:18 +0100 Subject: [PATCH 03/24] adapt test to new API --- test/forest/test_element_volume.jl | 20 +++++++++++--------- test/test_forestwrapper.jl | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/test/forest/test_element_volume.jl b/test/forest/test_element_volume.jl index 287ee63..0c51115 100644 --- a/test/forest/test_element_volume.jl +++ b/test/forest/test_element_volume.jl @@ -13,9 +13,10 @@ # elements and compute it element-specific. # \param[in] pyra A pyramid # \return The volume of the pyramid -function pyramid_control_volume(eclass_scheme::Ptr{t8_eclass_scheme}, +function pyramid_control_volume(scheme::Ptr{t8_scheme}, + tree_class::t8_eclass, pyra::Ptr{t8_element})::Cdouble - level = t8_element_level(eclass_scheme, pyra) + level = t8_element_get_level(scheme, tree_class, pyra) # Both pyramids and tets have 1/8th of the parents volume, if the shape does not switch. control_volume = 1.0 / 3.0 / (1 << (level * 3)) @@ -35,12 +36,12 @@ end for eclass in T8_ECLASS_ZERO:t8_eclass(T8_ECLASS_COUNT - 1) for level in 0:4 - scheme = t8_scheme_new_default_cxx() + scheme = t8_scheme_new_default() cmesh = t8_cmesh_new_hypercube(t8_eclass(eclass), comm, 0, 0, 0) forest = t8_forest_new_uniform(cmesh, scheme, level, 0, comm) # Compute the global number of elements. - global_num_elements = t8_forest_get_global_num_elements(forest) + global_num_elements = t8_forest_get_global_num_leaf_elements(forest) # Vertices have a volume of 0. control_volume = (eclass == T8_ECLASS_VERTEX) ? 0.0 : @@ -48,17 +49,18 @@ end local_num_trees = t8_forest_get_num_local_trees(forest) + # Get the scheme used by this forest + scheme = t8_forest_get_scheme(forest) + # Iterate over all elements. for itree in 0:(local_num_trees - 1) tree_class = t8_forest_get_tree_class(forest, itree) - eclass_scheme = t8_forest_get_eclass_scheme(forest, tree_class) - - tree_elements = t8_forest_get_tree_num_elements(forest, itree) + tree_elements = t8_forest_get_tree_num_leaf_elements(forest, itree) for ielement in 0:(tree_elements - 1) - element = t8_forest_get_element_in_tree(forest, itree, ielement) + element = t8_forest_get_leaf_element_in_tree(forest, itree, ielement) volume = t8_forest_element_volume(forest, itree, element) if eclass == T8_ECLASS_PYRAMID - shape_volume = pyramid_control_volume(eclass_scheme, element) + shape_volume = pyramid_control_volume(scheme, tree_class, element) # WORKAROUND: See `function pyramid_control_volume` for a comment # why the following test is split into two. @test abs(shape_volume - volume) <= epsilon || diff --git a/test/test_forestwrapper.jl b/test/test_forestwrapper.jl index 2c4b0fd..030c038 100644 --- a/test/test_forestwrapper.jl +++ b/test/test_forestwrapper.jl @@ -13,7 +13,7 @@ @test length(T8code.T8CODE_OBJECT_TRACKER) == 0 # Create a forest and wrap by `ForestWrapper` - scheme = t8_scheme_new_default_cxx() + scheme = t8_scheme_new_default() cmesh = t8_cmesh_new_hypercube(T8_ECLASS_QUAD, comm, 0, 0, 0) forest = t8_forest_new_uniform(cmesh, scheme, 0, 0, comm) wrapper_A = T8code.ForestWrapper(forest) @@ -21,7 +21,7 @@ @test length(T8code.T8CODE_OBJECT_TRACKER) == 1 # Create another forest and wrap by `ForestWrapper` - scheme = t8_scheme_new_default_cxx() + scheme = t8_scheme_new_default() cmesh = t8_cmesh_new_hypercube(T8_ECLASS_TRIANGLE, comm, 0, 0, 0) forest = t8_forest_new_uniform(cmesh, scheme, 0, 0, comm) wrapper_B = T8code.ForestWrapper(forest) From 892ede04db090c7d6476929163586ec8f3d4958c Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Thu, 11 Dec 2025 13:34:03 +0100 Subject: [PATCH 04/24] new t8code bindings based on preliminary Yggdrasil build --- src/Libt8.jl | 356 +++++++++++++++++---------------------------------- 1 file changed, 118 insertions(+), 238 deletions(-) diff --git a/src/Libt8.jl b/src/Libt8.jl index b75dc82..a240041 100644 --- a/src/Libt8.jl +++ b/src/Libt8.jl @@ -442,7 +442,7 @@ void sc_mpi_comm_attach_node_comms (sc_MPI_Comm comm, int processes_per_node); ``` """ function sc_mpi_comm_attach_node_comms(comm, processes_per_node) - @ccall libt8.sc_mpi_comm_attach_node_comms(comm::Cint, processes_per_node::Cint)::Cvoid + @ccall libt8.sc_mpi_comm_attach_node_comms(comm::MPI_Comm, processes_per_node::Cint)::Cvoid end """ @@ -454,7 +454,7 @@ void sc_mpi_comm_detach_node_comms (sc_MPI_Comm comm); ``` """ function sc_mpi_comm_detach_node_comms(comm) - @ccall libt8.sc_mpi_comm_detach_node_comms(comm::Cint)::Cvoid + @ccall libt8.sc_mpi_comm_detach_node_comms(comm::MPI_Comm)::Cvoid end """ @@ -466,7 +466,7 @@ void sc_mpi_comm_get_node_comms (sc_MPI_Comm comm, sc_MPI_Comm * intranode, sc_M ``` """ function sc_mpi_comm_get_node_comms(comm, intranode, internode) - @ccall libt8.sc_mpi_comm_get_node_comms(comm::Cint, intranode::Ptr{Cint}, internode::Ptr{Cint})::Cvoid + @ccall libt8.sc_mpi_comm_get_node_comms(comm::MPI_Comm, intranode::Ptr{MPI_Comm}, internode::Ptr{MPI_Comm})::Cvoid end """ @@ -478,7 +478,7 @@ int sc_mpi_comm_get_and_attach (sc_MPI_Comm comm); ``` """ function sc_mpi_comm_get_and_attach(comm) - @ccall libt8.sc_mpi_comm_get_and_attach(comm::Cint)::Cint + @ccall libt8.sc_mpi_comm_get_and_attach(comm::MPI_Comm)::Cint end # typedef void ( * sc_handler_t ) ( void * data ) @@ -869,7 +869,7 @@ void sc_init (sc_MPI_Comm mpicomm, int catch_signals, int print_backtrace, sc_lo ``` """ function sc_init(mpicomm, catch_signals, print_backtrace, log_handler, log_threshold) - @ccall libt8.sc_init(mpicomm::Cint, catch_signals::Cint, print_backtrace::Cint, log_handler::sc_log_handler_t, log_threshold::Cint)::Cvoid + @ccall libt8.sc_init(mpicomm::MPI_Comm, catch_signals::Cint, print_backtrace::Cint, log_handler::sc_log_handler_t, log_threshold::Cint)::Cvoid end """ @@ -4022,7 +4022,7 @@ void *sc_shmem_malloc (int package, size_t elem_size, size_t elem_count, sc_MPI_ ``` """ function sc_shmem_malloc(package, elem_size, elem_count, comm) - @ccall libt8.sc_shmem_malloc(package::Cint, elem_size::Csize_t, elem_count::Csize_t, comm::Cint)::Ptr{Cvoid} + @ccall libt8.sc_shmem_malloc(package::Cint, elem_size::Csize_t, elem_count::Csize_t, comm::MPI_Comm)::Ptr{Cvoid} end """ @@ -4034,7 +4034,7 @@ void sc_shmem_free (int package, void *array, sc_MPI_Comm comm); ``` """ function sc_shmem_free(package, array, comm) - @ccall libt8.sc_shmem_free(package::Cint, array::Ptr{Cvoid}, comm::Cint)::Cvoid + @ccall libt8.sc_shmem_free(package::Cint, array::Ptr{Cvoid}, comm::MPI_Comm)::Cvoid end """ @@ -4067,7 +4067,7 @@ void sc_shmem_set_type (sc_MPI_Comm comm, sc_shmem_type_t type); ``` """ function sc_shmem_set_type(comm, type) - @ccall libt8.sc_shmem_set_type(comm::Cint, type::sc_shmem_type_t)::Cvoid + @ccall libt8.sc_shmem_set_type(comm::MPI_Comm, type::sc_shmem_type_t)::Cvoid end """ @@ -4079,7 +4079,7 @@ sc_shmem_type_t sc_shmem_get_type (sc_MPI_Comm comm); ``` """ function sc_shmem_get_type(comm) - @ccall libt8.sc_shmem_get_type(comm::Cint)::sc_shmem_type_t + @ccall libt8.sc_shmem_get_type(comm::MPI_Comm)::sc_shmem_type_t end """ @@ -4091,7 +4091,7 @@ int sc_shmem_write_start (void *array, sc_MPI_Comm comm); ``` """ function sc_shmem_write_start(array, comm) - @ccall libt8.sc_shmem_write_start(array::Ptr{Cvoid}, comm::Cint)::Cint + @ccall libt8.sc_shmem_write_start(array::Ptr{Cvoid}, comm::MPI_Comm)::Cint end """ @@ -4103,7 +4103,7 @@ void sc_shmem_write_end (void *array, sc_MPI_Comm comm); ``` """ function sc_shmem_write_end(array, comm) - @ccall libt8.sc_shmem_write_end(array::Ptr{Cvoid}, comm::Cint)::Cvoid + @ccall libt8.sc_shmem_write_end(array::Ptr{Cvoid}, comm::MPI_Comm)::Cvoid end """ @@ -4115,7 +4115,7 @@ void sc_shmem_memcpy (void *destarray, void *srcarray, size_t bytes, sc_MPI_Comm ``` """ function sc_shmem_memcpy(destarray, srcarray, bytes, comm) - @ccall libt8.sc_shmem_memcpy(destarray::Ptr{Cvoid}, srcarray::Ptr{Cvoid}, bytes::Csize_t, comm::Cint)::Cvoid + @ccall libt8.sc_shmem_memcpy(destarray::Ptr{Cvoid}, srcarray::Ptr{Cvoid}, bytes::Csize_t, comm::MPI_Comm)::Cvoid end """ @@ -4127,7 +4127,7 @@ void sc_shmem_allgather (void *sendbuf, int sendcount, sc_MPI_Datatype sendtype, ``` """ function sc_shmem_allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm) - @ccall libt8.sc_shmem_allgather(sendbuf::Ptr{Cvoid}, sendcount::Cint, sendtype::Cint, recvbuf::Ptr{Cvoid}, recvcount::Cint, recvtype::Cint, comm::Cint)::Cvoid + @ccall libt8.sc_shmem_allgather(sendbuf::Ptr{Cvoid}, sendcount::Cint, sendtype::Cint, recvbuf::Ptr{Cvoid}, recvcount::Cint, recvtype::Cint, comm::MPI_Comm)::Cvoid end """ @@ -4139,7 +4139,7 @@ void sc_shmem_prefix (void *sendbuf, void *recvbuf, int count, sc_MPI_Datatype t ``` """ function sc_shmem_prefix(sendbuf, recvbuf, count, type, op, comm) - @ccall libt8.sc_shmem_prefix(sendbuf::Ptr{Cvoid}, recvbuf::Ptr{Cvoid}, count::Cint, type::Cint, op::Cint, comm::Cint)::Cvoid + @ccall libt8.sc_shmem_prefix(sendbuf::Ptr{Cvoid}, recvbuf::Ptr{Cvoid}, count::Cint, type::Cint, op::Cint, comm::MPI_Comm)::Cvoid end mutable struct t8_cmesh end @@ -4272,7 +4272,7 @@ t8_shmem_array_t t8_cmesh_alloc_offsets (int mpisize, sc_MPI_Comm comm); ``` """ function t8_cmesh_alloc_offsets(mpisize, comm) - @ccall libt8.t8_cmesh_alloc_offsets(mpisize::Cint, comm::Cint)::t8_shmem_array_t + @ccall libt8.t8_cmesh_alloc_offsets(mpisize::Cint, comm::MPI_Comm)::t8_shmem_array_t end """ @@ -4580,7 +4580,7 @@ t8_cmesh_t t8_cmesh_bcast (t8_cmesh_t cmesh_in, int root, sc_MPI_Comm comm); ``` """ function t8_cmesh_bcast(cmesh_in, root, comm) - @ccall libt8.t8_cmesh_bcast(cmesh_in::t8_cmesh_t, root::Cint, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_bcast(cmesh_in::t8_cmesh_t, root::Cint, comm::MPI_Comm)::t8_cmesh_t end mutable struct t8_geometry end @@ -4638,7 +4638,7 @@ void t8_cmesh_commit (t8_cmesh_t cmesh, sc_MPI_Comm comm); ``` """ function t8_cmesh_commit(cmesh, comm) - @ccall libt8.t8_cmesh_commit(cmesh::t8_cmesh_t, comm::Cint)::Cvoid + @ccall libt8.t8_cmesh_commit(cmesh::t8_cmesh_t, comm::MPI_Comm)::Cvoid end """ @@ -4671,7 +4671,7 @@ t8_cmesh_t t8_cmesh_load (const char *filename, sc_MPI_Comm comm); ``` """ function t8_cmesh_load(filename, comm) - @ccall libt8.t8_cmesh_load(filename::Cstring, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_load(filename::Cstring, comm::MPI_Comm)::t8_cmesh_t end """ @@ -4706,7 +4706,7 @@ t8_cmesh_t t8_cmesh_load_and_distribute (const char *fileprefix, int num_files, ``` """ function t8_cmesh_load_and_distribute(fileprefix, num_files, comm, mode, procs_per_node) - @ccall libt8.t8_cmesh_load_and_distribute(fileprefix::Cstring, num_files::Cint, comm::Cint, mode::t8_load_mode_t, procs_per_node::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_load_and_distribute(fileprefix::Cstring, num_files::Cint, comm::MPI_Comm, mode::t8_load_mode_t, procs_per_node::Cint)::t8_cmesh_t end """ @@ -4718,7 +4718,7 @@ int t8_cmesh_comm_is_valid (t8_cmesh_t cmesh, sc_MPI_Comm comm); ``` """ function t8_cmesh_comm_is_valid(cmesh, comm) - @ccall libt8.t8_cmesh_comm_is_valid(cmesh::t8_cmesh_t, comm::Cint)::Cint + @ccall libt8.t8_cmesh_comm_is_valid(cmesh::t8_cmesh_t, comm::MPI_Comm)::Cint end """ @@ -5261,7 +5261,7 @@ void t8_cmesh_uniform_bounds_for_irregular_refinement (const t8_cmesh_t cmesh, c ``` """ function t8_cmesh_uniform_bounds_for_irregular_refinement(cmesh, level, scheme, first_local_tree, child_in_tree_begin, last_local_tree, child_in_tree_end, first_tree_shared, comm) - @ccall libt8.t8_cmesh_uniform_bounds_for_irregular_refinement(cmesh::t8_cmesh_t, level::Cint, scheme::Ptr{t8_scheme_c}, first_local_tree::Ptr{t8_gloidx_t}, child_in_tree_begin::Ptr{t8_gloidx_t}, last_local_tree::Ptr{t8_gloidx_t}, child_in_tree_end::Ptr{t8_gloidx_t}, first_tree_shared::Ptr{Int8}, comm::Cint)::Cvoid + @ccall libt8.t8_cmesh_uniform_bounds_for_irregular_refinement(cmesh::t8_cmesh_t, level::Cint, scheme::Ptr{t8_scheme_c}, first_local_tree::Ptr{t8_gloidx_t}, child_in_tree_begin::Ptr{t8_gloidx_t}, last_local_tree::Ptr{t8_gloidx_t}, child_in_tree_end::Ptr{t8_gloidx_t}, first_tree_shared::Ptr{Int8}, comm::MPI_Comm)::Cvoid end """ @@ -5374,7 +5374,7 @@ void t8_cmesh_debug_print_trees (const t8_cmesh_t cmesh, sc_MPI_Comm comm); ``` """ function t8_cmesh_debug_print_trees(cmesh, comm) - @ccall libt8.t8_cmesh_debug_print_trees(cmesh::t8_cmesh_t, comm::Cint)::Cvoid + @ccall libt8.t8_cmesh_debug_print_trees(cmesh::t8_cmesh_t, comm::MPI_Comm)::Cvoid end """ @@ -5405,7 +5405,7 @@ void sc_io_read (sc_MPI_File mpifile, void *ptr, size_t zcount, sc_MPI_Datatype ``` """ function sc_io_read(mpifile, ptr, zcount, t, errmsg) - @ccall libt8.sc_io_read(mpifile::Cint, ptr::Ptr{Cvoid}, zcount::Csize_t, t::Cint, errmsg::Cstring)::Cvoid + @ccall libt8.sc_io_read(mpifile::MPI_File, ptr::Ptr{Cvoid}, zcount::Csize_t, t::Cint, errmsg::Cstring)::Cvoid end """ @@ -5417,7 +5417,7 @@ void sc_io_write (sc_MPI_File mpifile, const void *ptr, size_t zcount, sc_MPI_Da ``` """ function sc_io_write(mpifile, ptr, zcount, t, errmsg) - @ccall libt8.sc_io_write(mpifile::Cint, ptr::Ptr{Cvoid}, zcount::Csize_t, t::Cint, errmsg::Cstring)::Cvoid + @ccall libt8.sc_io_write(mpifile::MPI_File, ptr::Ptr{Cvoid}, zcount::Csize_t, t::Cint, errmsg::Cstring)::Cvoid end """Typedef for quadrant coordinates.""" @@ -6092,7 +6092,7 @@ int sc_io_open (sc_MPI_Comm mpicomm, const char *filename, sc_io_open_mode_t amo ``` """ function sc_io_open(mpicomm, filename, amode, mpiinfo, mpifile) - @ccall libt8.sc_io_open(mpicomm::Cint, filename::Cstring, amode::sc_io_open_mode_t, mpiinfo::Cint, mpifile::Ptr{Cint})::Cint + @ccall libt8.sc_io_open(mpicomm::MPI_Comm, filename::Cstring, amode::sc_io_open_mode_t, mpiinfo::Cint, mpifile::Ptr{Cint})::Cint end """ @@ -6104,7 +6104,7 @@ int sc_io_read_at (sc_MPI_File mpifile, sc_MPI_Offset offset, void *ptr, int cou ``` """ function sc_io_read_at(mpifile, offset, ptr, count, t, ocount) - @ccall libt8.sc_io_read_at(mpifile::Cint, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::Cint, ocount::Ptr{Cint})::Cint + @ccall libt8.sc_io_read_at(mpifile::MPI_File, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::Cint, ocount::Ptr{Cint})::Cint end """ @@ -6116,7 +6116,7 @@ int sc_io_read_at_all (sc_MPI_File mpifile, sc_MPI_Offset offset, void *ptr, int ``` """ function sc_io_read_at_all(mpifile, offset, ptr, count, t, ocount) - @ccall libt8.sc_io_read_at_all(mpifile::Cint, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::Cint, ocount::Ptr{Cint})::Cint + @ccall libt8.sc_io_read_at_all(mpifile::MPI_File, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::Cint, ocount::Ptr{Cint})::Cint end """ @@ -6128,7 +6128,7 @@ int sc_io_write_at (sc_MPI_File mpifile, sc_MPI_Offset offset, const void *ptr, ``` """ function sc_io_write_at(mpifile, offset, ptr, count, t, ocount) - @ccall libt8.sc_io_write_at(mpifile::Cint, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::Cint, ocount::Ptr{Cint})::Cint + @ccall libt8.sc_io_write_at(mpifile::MPI_File, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::Cint, ocount::Ptr{Cint})::Cint end """ @@ -6140,7 +6140,7 @@ int sc_io_write_at_all (sc_MPI_File mpifile, sc_MPI_Offset offset, const void *p ``` """ function sc_io_write_at_all(mpifile, offset, ptr, count, t, ocount) - @ccall libt8.sc_io_write_at_all(mpifile::Cint, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::Cint, ocount::Ptr{Cint})::Cint + @ccall libt8.sc_io_write_at_all(mpifile::MPI_File, offset::Cint, ptr::Ptr{Cvoid}, count::Cint, t::Cint, ocount::Ptr{Cint})::Cint end """ @@ -6814,7 +6814,7 @@ p4est_connectivity_t *p4est_connectivity_bcast (p4est_connectivity_t * conn_in, ``` """ function p4est_connectivity_bcast(conn_in, root, comm) - @ccall libt8.p4est_connectivity_bcast(conn_in::Ptr{p4est_connectivity_t}, root::Cint, comm::Cint)::Ptr{p4est_connectivity_t} + @ccall libt8.p4est_connectivity_bcast(conn_in::Ptr{p4est_connectivity_t}, root::Cint, comm::MPI_Comm)::Ptr{p4est_connectivity_t} end """ @@ -8169,7 +8169,7 @@ p8est_connectivity_t *p8est_connectivity_bcast (p8est_connectivity_t * conn_in, ``` """ function p8est_connectivity_bcast(conn_in, root, comm) - @ccall libt8.p8est_connectivity_bcast(conn_in::Ptr{p8est_connectivity_t}, root::Cint, comm::Cint)::Ptr{p8est_connectivity_t} + @ccall libt8.p8est_connectivity_bcast(conn_in::Ptr{p8est_connectivity_t}, root::Cint, comm::MPI_Comm)::Ptr{p8est_connectivity_t} end """ @@ -8927,7 +8927,7 @@ t8_cmesh_t t8_cmesh_new_from_p4est (p4est_connectivity_t *conn, sc_MPI_Comm comm ``` """ function t8_cmesh_new_from_p4est(conn, comm, do_partition) - @ccall libt8.t8_cmesh_new_from_p4est(conn::Ptr{p4est_connectivity_t}, comm::Cint, do_partition::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_from_p4est(conn::Ptr{p4est_connectivity_t}, comm::MPI_Comm, do_partition::Cint)::t8_cmesh_t end """ @@ -8939,7 +8939,7 @@ t8_cmesh_t t8_cmesh_new_from_p8est (p8est_connectivity_t *conn, sc_MPI_Comm comm ``` """ function t8_cmesh_new_from_p8est(conn, comm, do_partition) - @ccall libt8.t8_cmesh_new_from_p8est(conn::Ptr{p8est_connectivity_t}, comm::Cint, do_partition::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_from_p8est(conn::Ptr{p8est_connectivity_t}, comm::MPI_Comm, do_partition::Cint)::t8_cmesh_t end """ @@ -8951,7 +8951,7 @@ t8_cmesh_t t8_cmesh_new_empty (sc_MPI_Comm comm, const int do_partition, const i ``` """ function t8_cmesh_new_empty(comm, do_partition, dimension) - @ccall libt8.t8_cmesh_new_empty(comm::Cint, do_partition::Cint, dimension::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_empty(comm::MPI_Comm, do_partition::Cint, dimension::Cint)::t8_cmesh_t end """ @@ -8963,7 +8963,7 @@ t8_cmesh_t t8_cmesh_new_from_class (t8_eclass_t eclass, sc_MPI_Comm comm); ``` """ function t8_cmesh_new_from_class(eclass, comm) - @ccall libt8.t8_cmesh_new_from_class(eclass::t8_eclass_t, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_from_class(eclass::t8_eclass_t, comm::MPI_Comm)::t8_cmesh_t end """ @@ -8975,7 +8975,7 @@ t8_cmesh_t t8_cmesh_new_hypercube (t8_eclass_t eclass, sc_MPI_Comm comm, int do_ ``` """ function t8_cmesh_new_hypercube(eclass, comm, do_bcast, do_partition, periodic) - @ccall libt8.t8_cmesh_new_hypercube(eclass::t8_eclass_t, comm::Cint, do_bcast::Cint, do_partition::Cint, periodic::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_hypercube(eclass::t8_eclass_t, comm::MPI_Comm, do_bcast::Cint, do_partition::Cint, periodic::Cint)::t8_cmesh_t end """ @@ -8987,7 +8987,7 @@ t8_cmesh_t t8_cmesh_new_hypercube_pad (const t8_eclass_t eclass, sc_MPI_Comm com ``` """ function t8_cmesh_new_hypercube_pad(eclass, comm, boundary, polygons_x, polygons_y, polygons_z, use_axis_aligned) - @ccall libt8.t8_cmesh_new_hypercube_pad(eclass::t8_eclass_t, comm::Cint, boundary::Ptr{Cdouble}, polygons_x::t8_locidx_t, polygons_y::t8_locidx_t, polygons_z::t8_locidx_t, use_axis_aligned::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_hypercube_pad(eclass::t8_eclass_t, comm::MPI_Comm, boundary::Ptr{Cdouble}, polygons_x::t8_locidx_t, polygons_y::t8_locidx_t, polygons_z::t8_locidx_t, use_axis_aligned::Cint)::t8_cmesh_t end """ @@ -8999,7 +8999,7 @@ t8_cmesh_t t8_cmesh_new_hypercube_pad_ext (const t8_eclass_t eclass, sc_MPI_Comm ``` """ function t8_cmesh_new_hypercube_pad_ext(eclass, comm, boundary, polygons_x, polygons_y, polygons_z, periodic_x, periodic_y, periodic_z, use_axis_aligned, set_partition, offset) - @ccall libt8.t8_cmesh_new_hypercube_pad_ext(eclass::t8_eclass_t, comm::Cint, boundary::Ptr{Cdouble}, polygons_x::t8_locidx_t, polygons_y::t8_locidx_t, polygons_z::t8_locidx_t, periodic_x::Cint, periodic_y::Cint, periodic_z::Cint, use_axis_aligned::Cint, set_partition::Cint, offset::t8_gloidx_t)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_hypercube_pad_ext(eclass::t8_eclass_t, comm::MPI_Comm, boundary::Ptr{Cdouble}, polygons_x::t8_locidx_t, polygons_y::t8_locidx_t, polygons_z::t8_locidx_t, periodic_x::Cint, periodic_y::Cint, periodic_z::Cint, use_axis_aligned::Cint, set_partition::Cint, offset::t8_gloidx_t)::t8_cmesh_t end """ @@ -9011,7 +9011,7 @@ t8_cmesh_t t8_cmesh_new_hypercube_hybrid (sc_MPI_Comm comm, int do_partition, in ``` """ function t8_cmesh_new_hypercube_hybrid(comm, do_partition, periodic) - @ccall libt8.t8_cmesh_new_hypercube_hybrid(comm::Cint, do_partition::Cint, periodic::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_hypercube_hybrid(comm::MPI_Comm, do_partition::Cint, periodic::Cint)::t8_cmesh_t end """ @@ -9023,7 +9023,7 @@ t8_cmesh_t t8_cmesh_new_periodic (sc_MPI_Comm comm, int dim); ``` """ function t8_cmesh_new_periodic(comm, dim) - @ccall libt8.t8_cmesh_new_periodic(comm::Cint, dim::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_periodic(comm::MPI_Comm, dim::Cint)::t8_cmesh_t end """ @@ -9035,7 +9035,7 @@ t8_cmesh_t t8_cmesh_new_periodic_tri (sc_MPI_Comm comm); ``` """ function t8_cmesh_new_periodic_tri(comm) - @ccall libt8.t8_cmesh_new_periodic_tri(comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_periodic_tri(comm::MPI_Comm)::t8_cmesh_t end """ @@ -9047,7 +9047,7 @@ t8_cmesh_t t8_cmesh_new_periodic_hybrid (sc_MPI_Comm comm); ``` """ function t8_cmesh_new_periodic_hybrid(comm) - @ccall libt8.t8_cmesh_new_periodic_hybrid(comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_periodic_hybrid(comm::MPI_Comm)::t8_cmesh_t end """ @@ -9059,7 +9059,7 @@ t8_cmesh_t t8_cmesh_new_periodic_line_more_trees (sc_MPI_Comm comm); ``` """ function t8_cmesh_new_periodic_line_more_trees(comm) - @ccall libt8.t8_cmesh_new_periodic_line_more_trees(comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_periodic_line_more_trees(comm::MPI_Comm)::t8_cmesh_t end """ @@ -9071,7 +9071,7 @@ t8_cmesh_t t8_cmesh_new_bigmesh (t8_eclass_t eclass, int num_trees, sc_MPI_Comm ``` """ function t8_cmesh_new_bigmesh(eclass, num_trees, comm) - @ccall libt8.t8_cmesh_new_bigmesh(eclass::t8_eclass_t, num_trees::Cint, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_bigmesh(eclass::t8_eclass_t, num_trees::Cint, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9083,7 +9083,7 @@ t8_cmesh_t t8_cmesh_new_line_zigzag (sc_MPI_Comm comm); ``` """ function t8_cmesh_new_line_zigzag(comm) - @ccall libt8.t8_cmesh_new_line_zigzag(comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_line_zigzag(comm::MPI_Comm)::t8_cmesh_t end """ @@ -9095,7 +9095,7 @@ t8_cmesh_t t8_cmesh_new_prism_cake (sc_MPI_Comm comm, int num_of_prisms); ``` """ function t8_cmesh_new_prism_cake(comm, num_of_prisms) - @ccall libt8.t8_cmesh_new_prism_cake(comm::Cint, num_of_prisms::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_prism_cake(comm::MPI_Comm, num_of_prisms::Cint)::t8_cmesh_t end """ @@ -9107,7 +9107,7 @@ t8_cmesh_t t8_cmesh_new_prism_deformed (sc_MPI_Comm comm); ``` """ function t8_cmesh_new_prism_deformed(comm) - @ccall libt8.t8_cmesh_new_prism_deformed(comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_prism_deformed(comm::MPI_Comm)::t8_cmesh_t end """ @@ -9119,7 +9119,7 @@ t8_cmesh_t t8_cmesh_new_pyramid_deformed (sc_MPI_Comm comm); ``` """ function t8_cmesh_new_pyramid_deformed(comm) - @ccall libt8.t8_cmesh_new_pyramid_deformed(comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_pyramid_deformed(comm::MPI_Comm)::t8_cmesh_t end """ @@ -9131,7 +9131,7 @@ t8_cmesh_t t8_cmesh_new_prism_cake_funny_oriented (sc_MPI_Comm comm); ``` """ function t8_cmesh_new_prism_cake_funny_oriented(comm) - @ccall libt8.t8_cmesh_new_prism_cake_funny_oriented(comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_prism_cake_funny_oriented(comm::MPI_Comm)::t8_cmesh_t end """ @@ -9143,7 +9143,7 @@ t8_cmesh_t t8_cmesh_new_prism_geometry (sc_MPI_Comm comm); ``` """ function t8_cmesh_new_prism_geometry(comm) - @ccall libt8.t8_cmesh_new_prism_geometry(comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_prism_geometry(comm::MPI_Comm)::t8_cmesh_t end """ @@ -9155,7 +9155,7 @@ t8_cmesh_t t8_cmesh_new_brick_2d (t8_gloidx_t num_x, t8_gloidx_t num_y, int x_pe ``` """ function t8_cmesh_new_brick_2d(num_x, num_y, x_periodic, y_periodic, comm) - @ccall libt8.t8_cmesh_new_brick_2d(num_x::t8_gloidx_t, num_y::t8_gloidx_t, x_periodic::Cint, y_periodic::Cint, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_brick_2d(num_x::t8_gloidx_t, num_y::t8_gloidx_t, x_periodic::Cint, y_periodic::Cint, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9167,7 +9167,7 @@ t8_cmesh_t t8_cmesh_new_brick_3d (t8_gloidx_t num_x, t8_gloidx_t num_y, t8_gloid ``` """ function t8_cmesh_new_brick_3d(num_x, num_y, num_z, x_periodic, y_periodic, z_periodic, comm) - @ccall libt8.t8_cmesh_new_brick_3d(num_x::t8_gloidx_t, num_y::t8_gloidx_t, num_z::t8_gloidx_t, x_periodic::Cint, y_periodic::Cint, z_periodic::Cint, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_brick_3d(num_x::t8_gloidx_t, num_y::t8_gloidx_t, num_z::t8_gloidx_t, x_periodic::Cint, y_periodic::Cint, z_periodic::Cint, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9179,7 +9179,7 @@ t8_cmesh_t t8_cmesh_new_disjoint_bricks (t8_gloidx_t num_x, t8_gloidx_t num_y, t ``` """ function t8_cmesh_new_disjoint_bricks(num_x, num_y, num_z, x_periodic, y_periodic, z_periodic, comm) - @ccall libt8.t8_cmesh_new_disjoint_bricks(num_x::t8_gloidx_t, num_y::t8_gloidx_t, num_z::t8_gloidx_t, x_periodic::Cint, y_periodic::Cint, z_periodic::Cint, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_disjoint_bricks(num_x::t8_gloidx_t, num_y::t8_gloidx_t, num_z::t8_gloidx_t, x_periodic::Cint, y_periodic::Cint, z_periodic::Cint, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9191,7 +9191,7 @@ t8_cmesh_t t8_cmesh_new_tet_orientation_test (sc_MPI_Comm comm); ``` """ function t8_cmesh_new_tet_orientation_test(comm) - @ccall libt8.t8_cmesh_new_tet_orientation_test(comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_tet_orientation_test(comm::MPI_Comm)::t8_cmesh_t end """ @@ -9203,7 +9203,7 @@ t8_cmesh_t t8_cmesh_new_hybrid_gate (sc_MPI_Comm comm); ``` """ function t8_cmesh_new_hybrid_gate(comm) - @ccall libt8.t8_cmesh_new_hybrid_gate(comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_hybrid_gate(comm::MPI_Comm)::t8_cmesh_t end """ @@ -9215,7 +9215,7 @@ t8_cmesh_t t8_cmesh_new_hybrid_gate_deformed (sc_MPI_Comm comm); ``` """ function t8_cmesh_new_hybrid_gate_deformed(comm) - @ccall libt8.t8_cmesh_new_hybrid_gate_deformed(comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_hybrid_gate_deformed(comm::MPI_Comm)::t8_cmesh_t end """ @@ -9227,7 +9227,7 @@ t8_cmesh_t t8_cmesh_new_full_hybrid (sc_MPI_Comm comm); ``` """ function t8_cmesh_new_full_hybrid(comm) - @ccall libt8.t8_cmesh_new_full_hybrid(comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_full_hybrid(comm::MPI_Comm)::t8_cmesh_t end """ @@ -9239,7 +9239,7 @@ t8_cmesh_t t8_cmesh_new_pyramid_cake (sc_MPI_Comm comm, int num_of_pyra); ``` """ function t8_cmesh_new_pyramid_cake(comm, num_of_pyra) - @ccall libt8.t8_cmesh_new_pyramid_cake(comm::Cint, num_of_pyra::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_pyramid_cake(comm::MPI_Comm, num_of_pyra::Cint)::t8_cmesh_t end """ @@ -9251,7 +9251,7 @@ t8_cmesh_t t8_cmesh_new_long_brick_pyramid (sc_MPI_Comm comm, int num_cubes); ``` """ function t8_cmesh_new_long_brick_pyramid(comm, num_cubes) - @ccall libt8.t8_cmesh_new_long_brick_pyramid(comm::Cint, num_cubes::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_long_brick_pyramid(comm::MPI_Comm, num_cubes::Cint)::t8_cmesh_t end """ @@ -9263,7 +9263,7 @@ t8_cmesh_t t8_cmesh_new_row_of_cubes (t8_locidx_t num_trees, const int set_attri ``` """ function t8_cmesh_new_row_of_cubes(num_trees, set_attributes, do_partition, comm, package_id) - @ccall libt8.t8_cmesh_new_row_of_cubes(num_trees::t8_locidx_t, set_attributes::Cint, do_partition::Cint, comm::Cint, package_id::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_row_of_cubes(num_trees::t8_locidx_t, set_attributes::Cint, do_partition::Cint, comm::MPI_Comm, package_id::Cint)::t8_cmesh_t end """ @@ -9275,7 +9275,7 @@ t8_cmesh_t t8_cmesh_new_quadrangulated_disk (const double radius, sc_MPI_Comm co ``` """ function t8_cmesh_new_quadrangulated_disk(radius, comm) - @ccall libt8.t8_cmesh_new_quadrangulated_disk(radius::Cdouble, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_quadrangulated_disk(radius::Cdouble, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9287,7 +9287,7 @@ t8_cmesh_t t8_cmesh_new_triangulated_spherical_surface_octahedron (const double ``` """ function t8_cmesh_new_triangulated_spherical_surface_octahedron(radius, comm) - @ccall libt8.t8_cmesh_new_triangulated_spherical_surface_octahedron(radius::Cdouble, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_triangulated_spherical_surface_octahedron(radius::Cdouble, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9299,7 +9299,7 @@ t8_cmesh_t t8_cmesh_new_triangulated_spherical_surface_icosahedron (const double ``` """ function t8_cmesh_new_triangulated_spherical_surface_icosahedron(radius, comm) - @ccall libt8.t8_cmesh_new_triangulated_spherical_surface_icosahedron(radius::Cdouble, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_triangulated_spherical_surface_icosahedron(radius::Cdouble, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9311,7 +9311,7 @@ t8_cmesh_t t8_cmesh_new_triangulated_spherical_surface_cube (const double radius ``` """ function t8_cmesh_new_triangulated_spherical_surface_cube(radius, comm) - @ccall libt8.t8_cmesh_new_triangulated_spherical_surface_cube(radius::Cdouble, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_triangulated_spherical_surface_cube(radius::Cdouble, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9323,7 +9323,7 @@ t8_cmesh_t t8_cmesh_new_quadrangulated_spherical_surface (const double radius, s ``` """ function t8_cmesh_new_quadrangulated_spherical_surface(radius, comm) - @ccall libt8.t8_cmesh_new_quadrangulated_spherical_surface(radius::Cdouble, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_quadrangulated_spherical_surface(radius::Cdouble, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9335,7 +9335,7 @@ t8_cmesh_t t8_cmesh_new_prismed_spherical_shell_octahedron (const double inner_r ``` """ function t8_cmesh_new_prismed_spherical_shell_octahedron(inner_radius, shell_thickness, num_levels, num_layers, comm) - @ccall libt8.t8_cmesh_new_prismed_spherical_shell_octahedron(inner_radius::Cdouble, shell_thickness::Cdouble, num_levels::Cint, num_layers::Cint, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_prismed_spherical_shell_octahedron(inner_radius::Cdouble, shell_thickness::Cdouble, num_levels::Cint, num_layers::Cint, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9347,7 +9347,7 @@ t8_cmesh_t t8_cmesh_new_prismed_spherical_shell_icosahedron (const double inner_ ``` """ function t8_cmesh_new_prismed_spherical_shell_icosahedron(inner_radius, shell_thickness, num_levels, num_layers, comm) - @ccall libt8.t8_cmesh_new_prismed_spherical_shell_icosahedron(inner_radius::Cdouble, shell_thickness::Cdouble, num_levels::Cint, num_layers::Cint, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_prismed_spherical_shell_icosahedron(inner_radius::Cdouble, shell_thickness::Cdouble, num_levels::Cint, num_layers::Cint, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9359,7 +9359,7 @@ t8_cmesh_t t8_cmesh_new_cubed_spherical_shell (const double inner_radius, const ``` """ function t8_cmesh_new_cubed_spherical_shell(inner_radius, shell_thickness, num_trees, num_layers, comm) - @ccall libt8.t8_cmesh_new_cubed_spherical_shell(inner_radius::Cdouble, shell_thickness::Cdouble, num_trees::Cint, num_layers::Cint, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_cubed_spherical_shell(inner_radius::Cdouble, shell_thickness::Cdouble, num_trees::Cint, num_layers::Cint, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9371,7 +9371,7 @@ t8_cmesh_t t8_cmesh_new_cubed_sphere (const double radius, sc_MPI_Comm comm); ``` """ function t8_cmesh_new_cubed_sphere(radius, comm) - @ccall libt8.t8_cmesh_new_cubed_sphere(radius::Cdouble, comm::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_new_cubed_sphere(radius::Cdouble, comm::MPI_Comm)::t8_cmesh_t end """ @@ -9933,7 +9933,7 @@ void t8_shmem_init (sc_MPI_Comm comm); ``` """ function t8_shmem_init(comm) - @ccall libt8.t8_shmem_init(comm::Cint)::Cvoid + @ccall libt8.t8_shmem_init(comm::MPI_Comm)::Cvoid end """ @@ -9945,7 +9945,7 @@ void t8_shmem_finalize (sc_MPI_Comm comm); ``` """ function t8_shmem_finalize(comm) - @ccall libt8.t8_shmem_finalize(comm::Cint)::Cvoid + @ccall libt8.t8_shmem_finalize(comm::MPI_Comm)::Cvoid end """ @@ -9957,7 +9957,7 @@ void t8_shmem_set_type (sc_MPI_Comm comm, sc_shmem_type_t type); ``` """ function t8_shmem_set_type(comm, type) - @ccall libt8.t8_shmem_set_type(comm::Cint, type::sc_shmem_type_t)::Cvoid + @ccall libt8.t8_shmem_set_type(comm::MPI_Comm, type::sc_shmem_type_t)::Cvoid end """ @@ -9969,7 +9969,7 @@ void t8_shmem_array_init (t8_shmem_array_t *parray, size_t elem_size, size_t ele ``` """ function t8_shmem_array_init(parray, elem_size, elem_count, comm) - @ccall libt8.t8_shmem_array_init(parray::Ptr{t8_shmem_array_t}, elem_size::Csize_t, elem_count::Csize_t, comm::Cint)::Cvoid + @ccall libt8.t8_shmem_array_init(parray::Ptr{t8_shmem_array_t}, elem_size::Csize_t, elem_count::Csize_t, comm::MPI_Comm)::Cvoid end """ @@ -10081,7 +10081,7 @@ void t8_shmem_array_allgatherv (void *sendbuf, const int sendcount, sc_MPI_Datat ``` """ function t8_shmem_array_allgatherv(sendbuf, sendcount, sendtype, recvarray, recvtype, comm) - @ccall libt8.t8_shmem_array_allgatherv(sendbuf::Ptr{Cvoid}, sendcount::Cint, sendtype::Cint, recvarray::t8_shmem_array_t, recvtype::Cint, comm::Cint)::Cvoid + @ccall libt8.t8_shmem_array_allgatherv(sendbuf::Ptr{Cvoid}, sendcount::Cint, sendtype::Cint, recvarray::t8_shmem_array_t, recvtype::Cint, comm::MPI_Comm)::Cvoid end """ @@ -10093,7 +10093,7 @@ void t8_shmem_array_prefix (const void *sendbuf, t8_shmem_array_t recvarray, con ``` """ function t8_shmem_array_prefix(sendbuf, recvarray, count, type, op, comm) - @ccall libt8.t8_shmem_array_prefix(sendbuf::Ptr{Cvoid}, recvarray::t8_shmem_array_t, count::Cint, type::Cint, op::Cint, comm::Cint)::Cvoid + @ccall libt8.t8_shmem_array_prefix(sendbuf::Ptr{Cvoid}, recvarray::t8_shmem_array_t, count::Cint, type::Cint, op::Cint, comm::MPI_Comm)::Cvoid end """ @@ -10691,7 +10691,7 @@ end const sc_statinfo_t = sc_statinfo struct sc_stats - mpicomm::Cint + mpicomm::MPI_Comm kv::Ptr{sc_keyvalue_t} sarray::Ptr{sc_array_t} end @@ -10836,7 +10836,7 @@ void sc_stats_compute (sc_MPI_Comm mpicomm, int nvars, sc_statinfo_t * stats); ``` """ function sc_stats_compute(mpicomm, nvars, stats) - @ccall libt8.sc_stats_compute(mpicomm::Cint, nvars::Cint, stats::Ptr{sc_statinfo_t})::Cvoid + @ccall libt8.sc_stats_compute(mpicomm::MPI_Comm, nvars::Cint, stats::Ptr{sc_statinfo_t})::Cvoid end """ @@ -10848,7 +10848,7 @@ void sc_stats_compute1 (sc_MPI_Comm mpicomm, int nvars, sc_statinfo_t * stats); ``` """ function sc_stats_compute1(mpicomm, nvars, stats) - @ccall libt8.sc_stats_compute1(mpicomm::Cint, nvars::Cint, stats::Ptr{sc_statinfo_t})::Cvoid + @ccall libt8.sc_stats_compute1(mpicomm::MPI_Comm, nvars::Cint, stats::Ptr{sc_statinfo_t})::Cvoid end """ @@ -10904,7 +10904,7 @@ sc_statistics_t *sc_statistics_new (sc_MPI_Comm mpicomm); ``` """ function sc_statistics_new(mpicomm) - @ccall libt8.sc_statistics_new(mpicomm::Cint)::Ptr{sc_statistics_t} + @ccall libt8.sc_statistics_new(mpicomm::MPI_Comm)::Ptr{sc_statistics_t} end """ @@ -11064,46 +11064,10 @@ end | stats | The SC profiling stats of the forest. | | stats\\_computed | Switch indicating whether the profiling stats have been compute (1) or not (0) | """ -struct t8_forest - rc::t8_refcount_t - set_level::Cint - set_for_coarsening::Cint - mpicomm::Cint - cmesh::t8_cmesh_t - scheme::Ptr{t8_scheme_c} - maxlevel::Cint - maxlevel_existing::Cint - do_dup::Cint - dimension::Cint - incomplete_trees::Cint - set_from::t8_forest_t - from_method::t8_forest_from_t - set_adapt_fn::t8_forest_adapt_t - set_adapt_recursive::Cint - set_balance::Cint - do_ghost::Cint - ghost_type::t8_ghost_type_t - ghost_algorithm::Cint - user_data::Ptr{Cvoid} - user_function::Ptr{Cvoid} - t8code_data::Ptr{Cvoid} - committed::Cint - mpisize::Cint - mpirank::Cint - first_local_tree::t8_gloidx_t - last_local_tree::t8_gloidx_t - global_num_trees::t8_gloidx_t - trees::Ptr{sc_array_t} - ghosts::t8_forest_ghost_t - element_offsets::t8_shmem_array_t - global_first_desc::t8_shmem_array_t - tree_offsets::t8_shmem_array_t - local_num_leaf_elements::t8_locidx_t - global_num_leaf_elements::t8_gloidx_t - profile::Ptr{t8_profile_t} - stats::NTuple{17, sc_statinfo_t} - stats_computed::Cint -end +# This struct is not supposed to be read and modified directly. +# Besides, there is a circular dependency with `t8_forest_t` +# leading to an error output by Julia. +mutable struct t8_forest end """Opaque pointer to a forest implementation.""" const t8_forest_t = Ptr{t8_forest} @@ -11331,7 +11295,7 @@ void t8_forest_set_cmesh (t8_forest_t forest, t8_cmesh_t cmesh, sc_MPI_Comm comm ``` """ function t8_forest_set_cmesh(forest, cmesh, comm) - @ccall libt8.t8_forest_set_cmesh(forest::t8_forest_t, cmesh::t8_cmesh_t, comm::Cint)::Cvoid + @ccall libt8.t8_forest_set_cmesh(forest::t8_forest_t, cmesh::t8_cmesh_t, comm::MPI_Comm)::Cvoid end """ @@ -12058,7 +12022,7 @@ void t8_forest_partition_cmesh (t8_forest_t forest, sc_MPI_Comm comm, int set_pr ``` """ function t8_forest_partition_cmesh(forest, comm, set_profiling) - @ccall libt8.t8_forest_partition_cmesh(forest::t8_forest_t, comm::Cint, set_profiling::Cint)::Cvoid + @ccall libt8.t8_forest_partition_cmesh(forest::t8_forest_t, comm::MPI_Comm, set_profiling::Cint)::Cvoid end """ @@ -12070,7 +12034,7 @@ sc_MPI_Comm t8_forest_get_mpicomm (const t8_forest_t forest); ``` """ function t8_forest_get_mpicomm(forest) - @ccall libt8.t8_forest_get_mpicomm(forest::t8_forest_t)::Cint + @ccall libt8.t8_forest_get_mpicomm(forest::t8_forest_t)::MPI_Comm end """ @@ -12542,7 +12506,7 @@ t8_forest_t t8_forest_new_uniform (t8_cmesh_t cmesh, const t8_scheme_c *scheme, ``` """ function t8_forest_new_uniform(cmesh, scheme, level, do_face_ghost, comm) - @ccall libt8.t8_forest_new_uniform(cmesh::t8_cmesh_t, scheme::Ptr{t8_scheme_c}, level::Cint, do_face_ghost::Cint, comm::Cint)::t8_forest_t + @ccall libt8.t8_forest_new_uniform(cmesh::t8_cmesh_t, scheme::Ptr{t8_scheme_c}, level::Cint, do_face_ghost::Cint, comm::MPI_Comm)::t8_forest_t end """ @@ -15431,7 +15395,7 @@ void t8_element_MPI_Pack (const t8_scheme_c *scheme, const t8_eclass_t tree_clas ``` """ function t8_element_MPI_Pack(scheme, tree_class, elements, count, send_buffer, buffer_size, position, comm) - @ccall libt8.t8_element_MPI_Pack(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, elements::Ptr{Ptr{t8_element_t}}, count::Cuint, send_buffer::Ptr{Cvoid}, buffer_size::Cint, position::Ptr{Cint}, comm::Cint)::Cvoid + @ccall libt8.t8_element_MPI_Pack(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, elements::Ptr{Ptr{t8_element_t}}, count::Cuint, send_buffer::Ptr{Cvoid}, buffer_size::Cint, position::Ptr{Cint}, comm::MPI_Comm)::Cvoid end """ @@ -15443,7 +15407,7 @@ void t8_element_MPI_Pack_size (const t8_scheme_c *scheme, const t8_eclass_t tree ``` """ function t8_element_MPI_Pack_size(scheme, tree_class, count, comm, pack_size) - @ccall libt8.t8_element_MPI_Pack_size(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, count::Cuint, comm::Cint, pack_size::Ptr{Cint})::Cvoid + @ccall libt8.t8_element_MPI_Pack_size(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, count::Cuint, comm::MPI_Comm, pack_size::Ptr{Cint})::Cvoid end """ @@ -15455,7 +15419,7 @@ void t8_element_MPI_Unpack (const t8_scheme_c *scheme, const t8_eclass_t tree_cl ``` """ function t8_element_MPI_Unpack(scheme, tree_class, recvbuf, buffer_size, position, elements, count, comm) - @ccall libt8.t8_element_MPI_Unpack(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, recvbuf::Ptr{Cvoid}, buffer_size::Cint, position::Ptr{Cint}, elements::Ptr{Ptr{t8_element_t}}, count::Cuint, comm::Cint)::Cvoid + @ccall libt8.t8_element_MPI_Unpack(scheme::Ptr{t8_scheme_c}, tree_class::t8_eclass_t, recvbuf::Ptr{Cvoid}, buffer_size::Cint, position::Ptr{Cint}, elements::Ptr{Ptr{t8_element_t}}, count::Cuint, comm::MPI_Comm)::Cvoid end """ @@ -15556,7 +15520,7 @@ int t8_cmesh_vtk_write_file_via_API (t8_cmesh_t cmesh, const char *fileprefix, s ``` """ function t8_cmesh_vtk_write_file_via_API(cmesh, fileprefix, comm) - @ccall libt8.t8_cmesh_vtk_write_file_via_API(cmesh::t8_cmesh_t, fileprefix::Cstring, comm::Cint)::Cint + @ccall libt8.t8_cmesh_vtk_write_file_via_API(cmesh::t8_cmesh_t, fileprefix::Cstring, comm::MPI_Comm)::Cint end """ @@ -15587,7 +15551,7 @@ t8_cmesh_t t8_cmesh_from_msh_file (const char *fileprefix, int partition, sc_MPI ``` """ function t8_cmesh_from_msh_file(fileprefix, partition, comm, dim, master, use_cad_geometry) - @ccall libt8.t8_cmesh_from_msh_file(fileprefix::Cstring, partition::Cint, comm::Cint, dim::Cint, master::Cint, use_cad_geometry::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_from_msh_file(fileprefix::Cstring, partition::Cint, comm::MPI_Comm, dim::Cint, master::Cint, use_cad_geometry::Cint)::t8_cmesh_t end struct sc_flopinfo @@ -16199,7 +16163,7 @@ t8_cmesh_t t8_cmesh_from_tetgen_file (char *fileprefix, int partition, sc_MPI_Co ``` """ function t8_cmesh_from_tetgen_file(fileprefix, partition, comm, do_dup) - @ccall libt8.t8_cmesh_from_tetgen_file(fileprefix::Cstring, partition::Cint, comm::Cint, do_dup::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_from_tetgen_file(fileprefix::Cstring, partition::Cint, comm::MPI_Comm, do_dup::Cint)::t8_cmesh_t end """ @@ -16211,7 +16175,7 @@ t8_cmesh_t t8_cmesh_from_tetgen_file_time (char *fileprefix, int partition, sc_M ``` """ function t8_cmesh_from_tetgen_file_time(fileprefix, partition, comm, do_dup, fi, snapshot, stats, statentry) - @ccall libt8.t8_cmesh_from_tetgen_file_time(fileprefix::Cstring, partition::Cint, comm::Cint, do_dup::Cint, fi::Ptr{sc_flopinfo_t}, snapshot::Ptr{sc_flopinfo_t}, stats::Ptr{sc_statinfo_t}, statentry::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_from_tetgen_file_time(fileprefix::Cstring, partition::Cint, comm::MPI_Comm, do_dup::Cint, fi::Ptr{sc_flopinfo_t}, snapshot::Ptr{sc_flopinfo_t}, stats::Ptr{sc_statinfo_t}, statentry::Cint)::t8_cmesh_t end """ @@ -16223,7 +16187,7 @@ t8_cmesh_t t8_cmesh_from_triangle_file (char *fileprefix, int partition, sc_MPI_ ``` """ function t8_cmesh_from_triangle_file(fileprefix, partition, comm, do_dup) - @ccall libt8.t8_cmesh_from_triangle_file(fileprefix::Cstring, partition::Cint, comm::Cint, do_dup::Cint)::t8_cmesh_t + @ccall libt8.t8_cmesh_from_triangle_file(fileprefix::Cstring, partition::Cint, comm::MPI_Comm, do_dup::Cint)::t8_cmesh_t end mutable struct t8_cmesh_vertex_connectivity end @@ -17179,159 +17143,105 @@ const SC_VERSION_MINOR = 0 const SC_VERSION_POINT = 0 -# Skipping MacroDefinition: _sc_const const -const sc_MPI_ERR_ARG = MPI_ERR_ARG -const sc_MPI_ERR_COUNT = MPI_ERR_COUNT -const sc_MPI_ERR_UNKNOWN = MPI_ERR_UNKNOWN -const sc_MPI_ERR_NO_MEM = MPI_ERR_NO_MEM -const sc_MPI_MAX_ERROR_STRING = MPI_MAX_ERROR_STRING -const sc_MPI_ERR_FILE = MPI_ERR_FILE -const sc_MPI_ERR_NOT_SAME = MPI_ERR_NOT_SAME -const sc_MPI_ERR_AMODE = MPI_ERR_AMODE -const sc_MPI_ERR_UNSUPPORTED_DATAREP = MPI_ERR_UNSUPPORTED_DATAREP -const sc_MPI_ERR_UNSUPPORTED_OPERATION = MPI_ERR_UNSUPPORTED_OPERATION -const sc_MPI_ERR_NO_SUCH_FILE = MPI_ERR_NO_SUCH_FILE -const sc_MPI_ERR_FILE_EXISTS = MPI_ERR_FILE_EXISTS -const sc_MPI_ERR_BAD_FILE = MPI_ERR_BAD_FILE -const sc_MPI_ERR_ACCESS = MPI_ERR_ACCESS -const sc_MPI_ERR_NO_SPACE = MPI_ERR_NO_SPACE -const sc_MPI_ERR_QUOTA = MPI_ERR_QUOTA -const sc_MPI_ERR_READ_ONLY = MPI_ERR_READ_ONLY -const sc_MPI_ERR_FILE_IN_USE = MPI_ERR_FILE_IN_USE -const sc_MPI_ERR_DUP_DATAREP = MPI_ERR_DUP_DATAREP -const sc_MPI_ERR_CONVERSION = MPI_ERR_CONVERSION -const sc_MPI_ERR_IO = MPI_ERR_IO -const sc_MPI_ERR_LASTCODE = MPI_ERR_LASTCODE -const sc_MPI_Aint = MPI_Aint -const sc_MPI_COMM_WORLD = MPI_COMM_WORLD +const sc_MPI_COMM_WORLD = MPI.COMM_WORLD -const sc_MPI_COMM_SELF = MPI_COMM_SELF +const sc_MPI_COMM_SELF = MPI.COMM_SELF -const sc_MPI_BYTE = MPI_BYTE +const sc_MPI_BYTE = MPI.BYTE -const sc_MPI_CHAR = MPI_CHAR +const sc_MPI_CHAR = MPI.CHAR -const sc_MPI_UNSIGNED_CHAR = MPI_UNSIGNED_CHAR +const sc_MPI_UNSIGNED_CHAR = MPI.UNSIGNED_CHAR -const sc_MPI_SHORT = MPI_SHORT +const sc_MPI_SHORT = MPI.SHORT -const sc_MPI_UNSIGNED_SHORT = MPI_UNSIGNED_SHORT +const sc_MPI_UNSIGNED_SHORT = MPI.UNSIGNED_SHORT -const sc_MPI_INT = MPI_INT +const sc_MPI_INT = MPI.INT -const sc_MPI_UNSIGNED = MPI_UNSIGNED +const sc_MPI_UNSIGNED = MPI.UNSIGNED -const sc_MPI_LONG = MPI_LONG +const sc_MPI_LONG = MPI.LONG -const sc_MPI_UNSIGNED_LONG = MPI_UNSIGNED_LONG +const sc_MPI_UNSIGNED_LONG = MPI.UNSIGNED_LONG -const sc_MPI_UNSIGNED_LONG_LONG = MPI_UNSIGNED_LONG_LONG +const sc_MPI_UNSIGNED_LONG_LONG = MPI.UNSIGNED_LONG_LONG -const sc_MPI_SIGNED_CHAR = MPI_SIGNED_CHAR +const sc_MPI_SIGNED_CHAR = MPI.SIGNED_CHAR -const sc_MPI_INT8_T = MPI_INT8_T +const sc_MPI_INT8_T = MPI.INT8_T -const sc_MPI_LONG_LONG_INT = MPI_LONG_LONG_INT +const sc_MPI_LONG_LONG_INT = MPI.LONG_LONG_INT -const sc_MPI_FLOAT = MPI_FLOAT +const sc_MPI_FLOAT = MPI.FLOAT -const sc_MPI_DOUBLE = MPI_DOUBLE +const sc_MPI_DOUBLE = MPI.DOUBLE -const sc_MPI_DOUBLE_INT = MPI_DOUBLE_INT -const sc_MPI_PACKED = MPI_PACKED -const sc_MPI_Comm = MPI_Comm +const sc_MPI_Comm = MPI.Comm -const sc_MPI_Group = MPI_Group +const sc_MPI_Group = MPI.Group -const sc_MPI_Datatype = MPI_Datatype +const sc_MPI_Datatype = MPI.Datatype -const sc_MPI_Info = MPI_Info +const sc_MPI_Info = MPI.Info -const sc_MPI_Type_size = MPI_Type_size -const sc_MPI_Pack = MPI_Pack -const sc_MPI_Unpack = MPI_Unpack -const sc_MPI_Pack_size = MPI_Pack_size -const sc_MPI_Aint_diff = MPI_Aint_diff -const sc_MPI_MODE_RDONLY = MPI_MODE_RDONLY -const sc_MPI_MODE_RDWR = MPI_MODE_RDWR -const sc_MPI_MODE_WRONLY = MPI_MODE_WRONLY -const sc_MPI_MODE_CREATE = MPI_MODE_CREATE -const sc_MPI_MODE_EXCL = MPI_MODE_EXCL -const sc_MPI_MODE_DELETE_ON_CLOSE = MPI_MODE_DELETE_ON_CLOSE -const sc_MPI_MODE_UNIQUE_OPEN = MPI_MODE_UNIQUE_OPEN -const sc_MPI_MODE_SEQUENTIAL = MPI_MODE_SEQUENTIAL -const sc_MPI_MODE_APPEND = MPI_MODE_APPEND -const sc_MPI_SEEK_SET = MPI_SEEK_SET -const sc_MPI_SEEK_CUR = MPI_SEEK_CUR -const sc_MPI_SEEK_END = MPI_SEEK_END -const sc_MPI_Offset = MPI_Offset -const sc_MPI_File = MPI_File +const sc_MPI_File = MPI.File -const sc_MPI_FILE_NULL = MPI_FILE_NULL +const sc_MPI_FILE_NULL = MPI.FILE_NULL -const sc_MPI_File_open = MPI_File_open -const sc_MPI_File_close = MPI_File_close -const sc_MPI_File_get_view = MPI_File_get_view -const sc_MPI_File_set_view = MPI_File_set_view -const sc_MPI_File_write_all = MPI_File_write_all -const sc_MPI_File_read_all = MPI_File_read_all -const sc_MPI_File_write_at_all = MPI_File_write_at_all -const sc_MPI_File_read_at_all = MPI_File_read_at_all -const sc_MPI_File_get_size = MPI_File_get_size -const sc_MPI_File_set_size = MPI_File_set_size const SC_EPS = 2.220446049250313e-16 @@ -17365,9 +17275,7 @@ const SC_LP_SILENT = 9 const SC_LP_THRESHOLD = SC_LP_INFO -const t8_const = _sc_const -const t8_restrict = _sc_restrict const T8_MPI_LOCIDX = sc_MPI_INT @@ -17399,53 +17307,34 @@ const T8_ECLASS_MAX_CORNERS = 8 const T8_ECLASS_MAX_DIM = 3 -const T8_ECLASS_TO_DIMENSION_VALUES = {0, 1, 2, 2, 3, 3, 3, 3} -const T8_ECLASS_NUM_FACES_VALUES = {0, 2, 4, 3, 6, 4, 5, 5} -const T8_ECLASS_MAX_NUM_FACES_VALUES = {0, 2, 4, 6} -const T8_ECLASS_MAX_NUM_CHILDREN_VALUES = {1, 2, 4, 4, 8, 8, 8, 10} -# Skipping MacroDefinition: T8_FACE_VERTEX_TO_TREE_VERTEX_VALUES { { { - 1 } } , /* vertex */ { { 0 } , { 1 } } , /* line */ { { 0 , 2 } , { 1 , 3 } , { 0 , 1 } , { 2 , 3 } } , /* quad */ { { 1 , 2 } , { 0 , 2 } , { 0 , 1 } } , /* triangle */ { { 0 , 2 , 4 , 6 } , { 1 , 3 , 5 , 7 } , { 0 , 1 , 4 , 5 } , { 2 , 3 , 6 , 7 } , { 0 , 1 , 2 , 3 } , { 4 , 5 , 6 , 7 } } , /* hex */ { { 1 , 2 , 3 } , { 0 , 2 , 3 } , { 0 , 1 , 3 } , { 0 , 1 , 2 } } , /* tet */ { { 1 , 2 , 4 , 5 } , { 0 , 2 , 3 , 5 } , { 0 , 1 , 3 , 4 } , { 0 , 1 , 2 } , { 3 , 4 , 5 } } , /* prism */ { { 0 , 2 , 4 } , { 1 , 3 , 4 } , { 0 , 1 , 4 } , { 2 , 3 , 4 } , { 0 , 1 , 2 , 3 } } /* pyramid */ \ #} -# Skipping MacroDefinition: T8_FACE_EDGE_TO_TREE_EDGE_VALUES { { { - 1 } } , /* vertex */ { { 0 } } , /* line */ { { 0 } , { 1 } , { 2 } , { 3 } } , /* quad */ { { 0 } , { 1 } , { 2 } } , /* triangle */ { { 8 , 10 , 4 , 6 } , { 9 , 11 , 5 , 7 } , { 8 , 9 , 0 , 2 } , { 10 , 11 , 1 , 3 } , { 4 , 5 , 0 , 1 } , { 6 , 7 , 2 , 3 } } , /* hex */ { { 3 , 4 , 5 } , { 1 , 2 , 5 } , { 0 , 2 , 4 } , { 0 , 1 , 3 } } , /* tet */ { { 0 , 7 , 3 , 6 } , { 1 , 8 , 4 , 7 } , { 2 , 6 , 5 , 8 } , { 0 , 1 , 2 } , { 3 , 4 , 5 } } , /* prism */ { { - 1 } } , /* pyramid */ \ #} -# Skipping MacroDefinition: T8_FACE_TO_EDGE_NEIGHBOR_VALUES { { { - 1 } } , /* vertex */ { { - 1 } } , /* line */ { { 2 , 3 } , { 2 , 3 } , { 0 , 1 } , { 0 , 1 } } , /* quad */ { { 2 , 1 } , { 2 , 0 } , { 1 , 0 } } , /* triangle */ { { 0 , 1 , 2 , 3 } , { 0 , 1 , 2 , 3 } , { 4 , 5 , 6 , 7 } , { 4 , 5 , 6 , 7 } , { 8 , 9 , 10 , 11 } , { 8 , 9 , 10 , 11 } } , /* hex */ { { 0 , 1 , 2 } , { 0 , 3 , 4 } , { 1 , 3 , 5 } , { 2 , 4 , 5 } } , /* tet */ { { 1 , 2 , 4 , 5 } , { 0 , 2 , 3 , 5 } , { 0 , 1 , 3 , 4 } , { 6 , 7 , 8 } , { 6 , 7 , 8 } } , /* prism */ { { - 1 } } , /* pyramid */ \ #} -# Skipping MacroDefinition: T8_EDGE_VERTEX_TO_TREE_VERTEX_VALUES { { { - 1 } } , /* vertex */ { { 0 } , { 1 } } , /* line */ { { 0 , 2 } , { 1 , 3 } , { 0 , 1 } , { 2 , 3 } } , /* quad */ { { 1 , 2 } , { 0 , 2 } , { 0 , 1 } } , /* triangle */ { { 0 , 1 } , { 2 , 3 } , { 4 , 5 } , { 6 , 7 } , { 0 , 2 } , { 1 , 3 } , { 4 , 6 } , { 5 , 7 } , { 0 , 4 } , { 1 , 5 } , { 2 , 6 } , { 3 , 7 } } , /* hex */ { { 0 , 1 } , { 0 , 2 } , { 0 , 3 } , { 1 , 2 } , { 1 , 3 } , { 2 , 3 } } , /* tet */ { { 1 , 2 } , { 0 , 2 } , { 0 , 1 } , { 4 , 5 } , { 3 , 5 } , { 3 , 4 } , { 1 , 4 } , { 2 , 5 } , { 0 , 3 } } , /* prism */ { { - 1 } } , /* pyramid */ \ #} -# Skipping MacroDefinition: T8_EDGE_TO_FACE_VALUES { { { - 1 } } , /* vertex */ { { 0 } } , /* line */ { { 0 } , { 1 } , { 2 } , { 3 } } , /* quad */ { { 0 } , { 1 } , { 2 } } , /* triangle */ { { 2 , 4 } , { 3 , 4 } , { 2 , 5 } , { 3 , 5 } , { 0 , 4 } , { 1 , 4 } , { 0 , 5 } , { 1 , 5 } , { 0 , 2 } , { 1 , 2 } , { 0 , 3 } , { 1 , 3 } } , /* hex */ { { 2 , 3 } , { 1 , 3 } , { 1 , 2 } , { 0 , 3 } , { 0 , 2 } , { 0 , 1 } } , /* tet */ { { 0 , 3 } , { 1 , 3 } , { 2 , 3 } , { 0 , 4 } , { 1 , 4 } , { 2 , 4 } , { 0 , 2 } , { 0 , 1 } , { 1 , 2 } } , /* prism */ { { - 1 } } , /* pyramid */ \ #} -# Skipping MacroDefinition: T8_ECLASS_FACE_ORIENTATION_VALUES { { 0 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* vertex */ { 0 , 0 , - 1 , - 1 , - 1 , - 1 } , /* line */ { 0 , 0 , 0 , 0 , - 1 , - 1 } , /* quad */ { 0 , 0 , 0 , - 1 , - 1 , - 1 } , /* triangle */ { 0 , 1 , 1 , 0 , 0 , 1 } , /* hex */ { 0 , 1 , 0 , 1 , - 1 , - 1 } , /* tet */ { 1 , 0 , 1 , 0 , 1 , - 1 } , /* prism */ { 0 , 1 , 1 , 0 , 0 , - 1 } /* pyramid */ \ #} -const T8_REFERENCE_FACE_NORMAL_TET_VALUES = {{-1, 0, 0}, {1, 0, -1}, {0, -1, 1}, {0, 1, 0}} -const T8_ECLASS_NUM_VERTICES_VALUES = {1, 2, 4, 3, 8, 4, 6, 5} -const T8_ECLASS_NUM_EDGES_VALUES = {0, 1, 4, 3, 12, 6, 9, 8} -const T8_ECLASS_VTK_TYPE_VALUES = {1, 3, 9, 5, 12, 10, 13, 14} -# Skipping MacroDefinition: T8_ECLASS_VTK_TO_T8_CORNER_NUMBER_VALUES { { 0 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* vertex */ { 0 , 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* line */ { 0 , 1 , 3 , 2 , - 1 , - 1 , - 1 , - 1 } , /* quad */ { 0 , 1 , 2 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* triangle */ { 0 , 1 , 3 , 2 , 4 , 5 , 7 , 6 } , /* hex */ { 0 , 2 , 1 , 3 , - 1 , - 1 , - 1 , - 1 } , /* tet */ { 0 , 2 , 1 , 3 , 5 , 4 , - 1 , - 1 } , /* prism */ { 0 , 1 , 3 , 2 , 4 , - 1 , - 1 , - 1 } /* pyramid */ \ #} -# Skipping MacroDefinition: T8_ECLASS_T8_TO_VTK_CORNER_NUMBER_VALUES { { 0 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* vertex */ { 0 , 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* line */ { 0 , 1 , 3 , 2 , - 1 , - 1 , - 1 , - 1 } , /* quad */ { 0 , 1 , 2 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* triangle */ { 0 , 1 , 3 , 2 , 4 , 5 , 7 , 6 } , /* hex */ { 0 , 2 , 1 , 3 , - 1 , - 1 , - 1 , - 1 } , /* tet */ { 0 , 2 , 1 , 3 , 5 , 4 , - 1 , - 1 } , /* prism */ { 0 , 1 , 3 , 2 , 4 , - 1 , - 1 , - 1 } /* pyramid */ \ #} -# Skipping MacroDefinition: T8_ECLASS_FACE_TYPES_VALUES { { - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* vertex */ { 0 , 0 , - 1 , - 1 , - 1 , - 1 } , /* line */ { 1 , 1 , 1 , 1 , - 1 , - 1 } , /* quad */ { 1 , 1 , 1 , - 1 , - 1 , - 1 } , /* triangle */ { 2 , 2 , 2 , 2 , 2 , 2 } , /* hex */ { 3 , 3 , 3 , 3 , - 1 , - 1 } , /* tet */ { 2 , 2 , 2 , 3 , 3 , - 1 } , /* prism */ { 3 , 3 , 3 , 3 , 2 , - 1 } /* pyramid */ \ #} -# Skipping MacroDefinition: T8_ECLASS_BOUNDARY_COUNT_VALUES { { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , /* vertex */ { 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , /* line */ { 4 , 4 , 0 , 0 , 0 , 0 , 0 , 0 } , /* quad */ { 3 , 3 , 0 , 0 , 0 , 0 , 0 , 0 } , /* triangle */ { 8 , 12 , 6 , 0 , 0 , 0 , 0 , 0 } , /* hex */ { 4 , 6 , 0 , 4 , 0 , 0 , 0 , 0 } , /* tet */ { 6 , 9 , 3 , 2 , 0 , 0 , 0 , 0 } , /* prism */ { 5 , 8 , 1 , 4 , 0 , 0 , 0 , 0 } /* pyramid */ \ #} -const T8_ECLASS_TO_STRING_VALUES = {"Vertex", "Line", "Quad", "Triangle", "Hex", "Tet", "Prism", "Pyramid", "Invalid"} # Skipping MacroDefinition: T8_MPI_ELEMENT_SHAPE_TYPE ( T8_ASSERT ( sizeof ( int ) == sizeof ( t8_element_shape_t ) ) , sc_MPI_INT ) @@ -17453,7 +17342,6 @@ const T8_ELEMENT_SHAPE_MAX_FACES = 6 const T8_ELEMENT_SHAPE_MAX_CORNERS = 8 -const T8_VERSION_POINT_STRING = T8_STRINGIFY_MIDDLE(T8_VERSION_POINT) const T8_VTK_LOCIDX = "Int32" @@ -17541,7 +17429,6 @@ const P4EST_MPI_QCOORD = sc_MPI_INT const P4EST_VTK_QCOORD = "Int32" -const P4EST_F90_QCOORD = INTEGER(KIND = C_INT32_T) const P4EST_QCOORD_MIN = INT32_MIN @@ -17557,7 +17444,6 @@ const P4EST_MPI_TOPIDX = sc_MPI_INT const P4EST_VTK_TOPIDX = "Int32" -const P4EST_F90_TOPIDX = INTEGER(KIND = C_INT32_T) const P4EST_TOPIDX_MIN = INT32_MIN @@ -17575,7 +17461,6 @@ const P4EST_MPI_LOCIDX = sc_MPI_INT const P4EST_VTK_LOCIDX = "Int32" -const P4EST_F90_LOCIDX = INTEGER(KIND = C_INT32_T) const P4EST_LOCIDX_MIN = INT32_MIN @@ -17591,7 +17476,6 @@ const P4EST_MPI_GLOIDX = sc_MPI_LONG_LONG_INT const P4EST_VTK_GLOIDX = "Int64" -const P4EST_F90_GLOIDX = INTEGER(KIND = C_INT64_T) const P4EST_GLOIDX_MIN = INT64_MIN @@ -17599,13 +17483,9 @@ const P4EST_GLOIDX_MAX = INT64_MAX const P4EST_GLOIDX_1 = p4est_gloidx_t(1) -const P4EST_GLOBAL_NOTICE = P4EST_GLOBAL_STATISTICS -const P4EST_GLOBAL_NOTICEF = P4EST_GLOBAL_STATISTICSF -const P4EST_NOTICE = P4EST_STATISTICS -const P4EST_NOTICEF = P4EST_STATISTICSF const P4EST_DIM = 2 From 3ce47be88506bf8214b277e10ec9b6d313a03d22 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Thu, 11 Dec 2025 13:34:41 +0100 Subject: [PATCH 05/24] clean up fixes.sh --- dev/fixes.sh | 107 +++++++-------------------------------------------- 1 file changed, 14 insertions(+), 93 deletions(-) diff --git a/dev/fixes.sh b/dev/fixes.sh index fe4a032..6ff2e4b 100755 --- a/dev/fixes.sh +++ b/dev/fixes.sh @@ -9,93 +9,36 @@ LIB_JL="Libt8.jl" set -euxo pipefail -sed -i "s/using CEnum/using CEnum: @cenum/g" "${LIB_JL}" - -# Remove Fortran macros -sed -i "/INTEGER(KIND/d" "${LIB_JL}" - -# Remove other probably unused macros -sed -i "/P4EST_NOTICE/d" "${LIB_JL}" -sed -i "/P4EST_GLOBAL_NOTICE/d" "${LIB_JL}" - # Fix MPI types that have been wrongly converted to Julia types sed -i "s/mpicomm::Cint/mpicomm::MPI_Comm/g" "${LIB_JL}" sed -i "s/\bcomm::Cint/comm::MPI_Comm/g" "${LIB_JL}" +sed -i "s/\bcomm::Cint/comm::MPI_Comm/g" "${LIB_JL}" sed -i "s/\bintranode::Ptr{Cint}/intranode::Ptr{MPI_Comm}/g" "${LIB_JL}" sed -i "s/\binternode::Ptr{Cint}/internode::Ptr{MPI_Comm}/g" "${LIB_JL}" sed -i "s/mpifile::Cint/mpifile::MPI_File/g" "${LIB_JL}" -sed -i "s/mpidatatype::Cint/mpidatatype::MPI_Datatype/g" "${LIB_JL}" -sed -i "s/\bt::Cint/t::MPI_Datatype/g" "${LIB_JL}" - -sed -i "s/t8_forest_get_mpicomm\(forest::t8_forest_t\)::Cint/t8_forest_get_mpicomm(forest::t8_forest_t)::MPI_Comm/g" "${LIB_JL}" -sed -i "s/forest::Cint/forest::t8_forest_t/" "${LIB_JL}" +sed -i "s/t8_forest_get_mpicomm(forest::t8_forest_t)::Cint/t8_forest_get_mpicomm(forest::t8_forest_t)::MPI_Comm/g" "${LIB_JL}" -# Use libsc for `sc_*` functions -sed -i "s/libt8\.sc_/libsc.sc_/g" "${LIB_JL}" - -# Use libp4est for `p4est_*` functions -sed -i "s/libt8\.p4est_/libp4est.p4est_/g" "${LIB_JL}" - -# Use libp4est for `p6est_*` functions -sed -i "s/libt8\.p6est_/libp4est.p6est_/g" "${LIB_JL}" - -# Use libp4est for `p8est_*` functions -sed -i "s/libt8\.p8est_/libp4est.p8est_/g" "${LIB_JL}" - - -# Fix type of `sc_array` field `array` -sed -i "s/array::Cstring/array::Ptr{Int8}/g" "${LIB_JL}" - -# Remove cross references that are not found -sed -i "s/\[\`p4est\`](@ref)/\`p4est\`/g" "${LIB_JL}" -sed -i "s/\[\`p6est\`](@ref)/\`p6est\`/g" "${LIB_JL}" -sed -i "s/\[\`p8est\`](@ref)/\`p8est\`/g" "${LIB_JL}" -sed -i "s/\[\`P4EST_QMAXLEVEL\`](@ref)/\`P4EST_QMAXLEVEL\`/g" "${LIB_JL}" -sed -i "s/\[\`P8EST_QMAXLEVEL\`](@ref)/\`P8EST_QMAXLEVEL\`/g" "${LIB_JL}" -sed -i "s/\[\`P4EST_CONN_DISK_PERIODIC\`](@ref)/\`P4EST_CONN_DISK_PERIODIC\`/g" "${LIB_JL}" -sed -i "s/\[\`p8est_iter_corner_side_t\`](@ref)/\`p8est_iter_corner_side_t\`/g" "${LIB_JL}" -sed -i "s/\[\`p8est_iter_edge_side_t\`](@ref)/\`p8est_iter_edge_side_t\`/g" "${LIB_JL}" -sed -i "s/\[\`p4est_corner_info_t\`](@ref)/\`p4est_corner_info_t\`/g" "${LIB_JL}" -sed -i "s/\[\`p8est_corner_info_t\`](@ref)/\`p8est_corner_info_t\`/g" "${LIB_JL}" -sed -i "s/\[\`p8est_edge_info_t\`](@ref)/\`p8est_edge_info_t\`/g" "${LIB_JL}" -sed -i "s/\[\`sc_MPI_Barrier\`](@ref)/\`sc_MPI_Barrier\`/g" "${LIB_JL}" -sed -i "s/\[\`sc_MPI_COMM_NULL\`](@ref)/\`sc_MPI_COMM_NULL\`/g" "${LIB_JL}" -sed -i "s/\[\`SC_CHECK_ABORT\`](@ref)/\`SC_CHECK_ABORT\`/g" "${LIB_JL}" -sed -i "s/\[\`SC_LP_DEFAULT\`](@ref)/\`SC_LP_DEFAULT\`/g" "${LIB_JL}" -sed -i "s/\[\`SC_LC_NORMAL\`](@ref)/\`SC_LC_NORMAL\`/g" "${LIB_JL}" -sed -i "s/\[\`SC_LC_GLOBAL\`](@ref)/\`SC_LC_GLOBAL\`/g" "${LIB_JL}" -sed -i "s/\[\`SC_LP_ALWAYS\`](@ref)/\`SC_LP_ALWAYS\`/g" "${LIB_JL}" -sed -i "s/\[\`SC_LP_SILENT\`](@ref)/\`SC_LP_SILENT\`/g" "${LIB_JL}" -sed -i "s/\[\`SC_LP_THRESHOLD\`](@ref)/\`SC_LP_THRESHOLD\`/g" "${LIB_JL}" -sed -i "s/\[\`sc_logf\`](@ref)/\`sc_logf\`/g" "${LIB_JL}" - -# For nicer docstrings -sed -i "s/\`p4est\`.h/\`p4est.h\`/g" "${LIB_JL}" -sed -i "s/\`p8est\`.h/\`p8est.h\`/g" "${LIB_JL}" +# Remove Fortran macros +sed -i "/INTEGER(KIND/d" "${LIB_JL}" -sed -i "/_sc_const/d" "${LIB_JL}" -sed -i "/_sc_restrict/d" "${LIB_JL}" -sed -i "/sc_keyvalue_t/d" "${LIB_JL}" +# Remove local arrays +sed -i "/T8_.*_VALUES/d" "${LIB_JL}" +# Remove misc sed -i "/T8_VERSION_POINT/d" "${LIB_JL}" -sed -i "/P4EST_VERSION_POINT/d" "${LIB_JL}" sed -i "/P4EST_GLOBAL_NOTICE/d" "${LIB_JL}" sed -i "/P4EST_NOTICE/d" "${LIB_JL}" -sed -i "/P4EST_F90_QCOORD/d" "${LIB_JL}" -sed -i "/P4EST_F90_TOPIDX/d" "${LIB_JL}" -sed -i "/P4EST_F90_LOCIDX/d" "${LIB_JL}" -sed -i "/P4EST_F90_GLOIDX/d" "${LIB_JL}" - -sed -i "/MPI_ERR_GROUP/d" "${LIB_JL}" - -sed -i "/SC_VERSION_POINT/d" "${LIB_JL}" +sed -i "/_sc_const/d" "${LIB_JL}" +sed -i "/_sc_restrict/d" "${LIB_JL}" +# Remove MPI macros not available in MPI.jl sed -i "/sc_MPI_PACKED/d" "${LIB_JL}" sed -i "/sc_MPI_Pack/d" "${LIB_JL}" sed -i "/sc_MPI_Unpack/d" "${LIB_JL}" +sed -i "/sc_MPI_DOUBLE_INT/d" "${LIB_JL}" sed -i "/= MPI_MODE_/d" "${LIB_JL}" sed -i "/= MPI_SEEK_/d" "${LIB_JL}" @@ -104,31 +47,9 @@ sed -i "/= MPI_MAX_/d" "${LIB_JL}" sed -i "/= MPI_Type_/d" "${LIB_JL}" sed -i "/= MPI_Offset/d" "${LIB_JL}" sed -i "/= MPI_File_/d" "${LIB_JL}" +sed -i "/= MPI_Aint/d" "${LIB_JL}" sed -i "s/= MPI_/= MPI./" "${LIB_JL}" -sed -i "s/packageid/package_id/" "${LIB_JL}" - -cat << EOT >&2 - -# !!!!!! # -# !!!!!! # - -# Manual fix. # - -Additionally, comment out - - struct t8_forest - [...] - end - -and add - - mutable struct t8_forest end - -in order to avoid error output due to -circular dependency of 't8_forest_t'. - -# !!!!!! # -# !!!!!! # -EOT +# remove struct t8_forest definition and replace by forward declaration +sed -i -z 's/\nstruct t8_forest.*stats_computed::Cint\nend/\n# This struct is not supposed to be read and modified directly.\n# Besides, there is a circular dependency with `t8_forest_t`\n# leading to an error output by Julia.\nmutable struct t8_forest end/g' "${LIB_JL}" From 318f285ef576b6c30c23026c7aa82124f2b5c23a Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Thu, 11 Dec 2025 13:42:03 +0100 Subject: [PATCH 06/24] missed line --- dev/fixes.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dev/fixes.sh b/dev/fixes.sh index 6ff2e4b..f344e78 100755 --- a/dev/fixes.sh +++ b/dev/fixes.sh @@ -12,13 +12,17 @@ set -euxo pipefail # Fix MPI types that have been wrongly converted to Julia types sed -i "s/mpicomm::Cint/mpicomm::MPI_Comm/g" "${LIB_JL}" sed -i "s/\bcomm::Cint/comm::MPI_Comm/g" "${LIB_JL}" -sed -i "s/\bcomm::Cint/comm::MPI_Comm/g" "${LIB_JL}" sed -i "s/\bintranode::Ptr{Cint}/intranode::Ptr{MPI_Comm}/g" "${LIB_JL}" sed -i "s/\binternode::Ptr{Cint}/internode::Ptr{MPI_Comm}/g" "${LIB_JL}" sed -i "s/mpifile::Cint/mpifile::MPI_File/g" "${LIB_JL}" sed -i "s/t8_forest_get_mpicomm(forest::t8_forest_t)::Cint/t8_forest_get_mpicomm(forest::t8_forest_t)::MPI_Comm/g" "${LIB_JL}" +# Remove struct t8_forest definition and replace by forward declaration +sed -i -z 's/\nstruct t8_forest.*stats_computed::Cint\nend/\n# This struct is not supposed to be read and modified directly.\n# Besides, there is a circular dependency with `t8_forest_t`\n# leading to an error output by Julia.\nmutable struct t8_forest end/g' "${LIB_JL}" + +sed -i "s/forest::Cint/forest::t8_forest_t/" "${LIB_JL}" + # Remove Fortran macros sed -i "/INTEGER(KIND/d" "${LIB_JL}" @@ -50,6 +54,3 @@ sed -i "/= MPI_File_/d" "${LIB_JL}" sed -i "/= MPI_Aint/d" "${LIB_JL}" sed -i "s/= MPI_/= MPI./" "${LIB_JL}" - -# remove struct t8_forest definition and replace by forward declaration -sed -i -z 's/\nstruct t8_forest.*stats_computed::Cint\nend/\n# This struct is not supposed to be read and modified directly.\n# Besides, there is a circular dependency with `t8_forest_t`\n# leading to an error output by Julia.\nmutable struct t8_forest end/g' "${LIB_JL}" From eaaba1fc07b4838c44705f51dd027cad50419943 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Thu, 11 Dec 2025 13:53:29 +0100 Subject: [PATCH 07/24] fixed forest::Cint --- src/Libt8.jl | 72 ++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/Libt8.jl b/src/Libt8.jl index a240041..73a5891 100644 --- a/src/Libt8.jl +++ b/src/Libt8.jl @@ -12576,7 +12576,7 @@ int t8_forest_get_dimension (const t8_forest_t forest); ``` """ function t8_forest_get_dimension(forest) - @ccall libt8.t8_forest_get_dimension(forest::Cint)::Cint + @ccall libt8.t8_forest_get_dimension(forest::t8_forest_t)::Cint end """ @@ -12588,7 +12588,7 @@ void t8_forest_element_coordinate (t8_forest_t forest, t8_locidx_t ltree_id, con ``` """ function t8_forest_element_coordinate(forest, ltree_id, element, corner_number, coordinates) - @ccall libt8.t8_forest_element_coordinate(forest::Cint, ltree_id::t8_locidx_t, element::Ptr{t8_element_t}, corner_number::Cint, coordinates::Ptr{Cdouble})::Cvoid + @ccall libt8.t8_forest_element_coordinate(forest::t8_forest_t, ltree_id::t8_locidx_t, element::Ptr{t8_element_t}, corner_number::Cint, coordinates::Ptr{Cdouble})::Cvoid end """ @@ -12600,7 +12600,7 @@ void t8_forest_element_from_ref_coords_ext (t8_forest_t forest, t8_locidx_t ltre ``` """ function t8_forest_element_from_ref_coords_ext(forest, ltreeid, element, ref_coords, num_coords, coords_out, stretch_factors) - @ccall libt8.t8_forest_element_from_ref_coords_ext(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, coords_out::Ptr{Cdouble}, stretch_factors::Ptr{Cdouble})::Cvoid + @ccall libt8.t8_forest_element_from_ref_coords_ext(forest::t8_forest_t, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, coords_out::Ptr{Cdouble}, stretch_factors::Ptr{Cdouble})::Cvoid end """ @@ -12612,7 +12612,7 @@ void t8_forest_element_from_ref_coords (t8_forest_t forest, t8_locidx_t ltreeid, ``` """ function t8_forest_element_from_ref_coords(forest, ltreeid, element, ref_coords, num_coords, coords_out) - @ccall libt8.t8_forest_element_from_ref_coords(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, coords_out::Ptr{Cdouble})::Cvoid + @ccall libt8.t8_forest_element_from_ref_coords(forest::t8_forest_t, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, ref_coords::Ptr{Cdouble}, num_coords::Csize_t, coords_out::Ptr{Cdouble})::Cvoid end """ @@ -12624,7 +12624,7 @@ void t8_forest_element_centroid (t8_forest_t forest, t8_locidx_t ltreeid, const ``` """ function t8_forest_element_centroid(forest, ltreeid, element, coordinates) - @ccall libt8.t8_forest_element_centroid(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, coordinates::Ptr{Cdouble})::Cvoid + @ccall libt8.t8_forest_element_centroid(forest::t8_forest_t, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, coordinates::Ptr{Cdouble})::Cvoid end """ @@ -12636,7 +12636,7 @@ double t8_forest_element_diam (t8_forest_t forest, t8_locidx_t ltreeid, const t8 ``` """ function t8_forest_element_diam(forest, ltreeid, element) - @ccall libt8.t8_forest_element_diam(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t})::Cdouble + @ccall libt8.t8_forest_element_diam(forest::t8_forest_t, ltreeid::t8_locidx_t, element::Ptr{t8_element_t})::Cdouble end """ @@ -12648,7 +12648,7 @@ double t8_forest_element_volume (t8_forest_t forest, t8_locidx_t ltreeid, const ``` """ function t8_forest_element_volume(forest, ltreeid, element) - @ccall libt8.t8_forest_element_volume(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t})::Cdouble + @ccall libt8.t8_forest_element_volume(forest::t8_forest_t, ltreeid::t8_locidx_t, element::Ptr{t8_element_t})::Cdouble end """ @@ -12660,7 +12660,7 @@ double t8_forest_element_face_area (t8_forest_t forest, t8_locidx_t ltreeid, con ``` """ function t8_forest_element_face_area(forest, ltreeid, element, face) - @ccall libt8.t8_forest_element_face_area(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, face::Cint)::Cdouble + @ccall libt8.t8_forest_element_face_area(forest::t8_forest_t, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, face::Cint)::Cdouble end """ @@ -12672,7 +12672,7 @@ void t8_forest_element_face_centroid (t8_forest_t forest, t8_locidx_t ltreeid, c ``` """ function t8_forest_element_face_centroid(forest, ltreeid, element, face, centroid) - @ccall libt8.t8_forest_element_face_centroid(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, face::Cint, centroid::Ptr{Cdouble})::Cvoid + @ccall libt8.t8_forest_element_face_centroid(forest::t8_forest_t, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, face::Cint, centroid::Ptr{Cdouble})::Cvoid end """ @@ -12684,7 +12684,7 @@ void t8_forest_element_face_normal (t8_forest_t forest, t8_locidx_t ltreeid, con ``` """ function t8_forest_element_face_normal(forest, ltreeid, element, face, normal) - @ccall libt8.t8_forest_element_face_normal(forest::Cint, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, face::Cint, normal::Ptr{Cdouble})::Cvoid + @ccall libt8.t8_forest_element_face_normal(forest::t8_forest_t, ltreeid::t8_locidx_t, element::Ptr{t8_element_t}, face::Cint, normal::Ptr{Cdouble})::Cvoid end """ @@ -13071,7 +13071,7 @@ void t8_forest_save (t8_forest_t forest); ``` """ function t8_forest_save(forest) - @ccall libt8.t8_forest_save(forest::Cint)::Cvoid + @ccall libt8.t8_forest_save(forest::t8_forest_t)::Cvoid end """ @@ -13083,7 +13083,7 @@ int t8_forest_write_vtk_ext (t8_forest_t forest, const char *fileprefix, const i ``` """ function t8_forest_write_vtk_ext(forest, fileprefix, write_treeid, write_mpirank, write_level, write_element_id, write_ghosts, write_curved, do_not_use_API, num_data, data) - @ccall libt8.t8_forest_write_vtk_ext(forest::Cint, fileprefix::Cstring, write_treeid::Cint, write_mpirank::Cint, write_level::Cint, write_element_id::Cint, write_ghosts::Cint, write_curved::Cint, do_not_use_API::Cint, num_data::Cint, data::Ptr{t8_vtk_data_field_t})::Cint + @ccall libt8.t8_forest_write_vtk_ext(forest::t8_forest_t, fileprefix::Cstring, write_treeid::Cint, write_mpirank::Cint, write_level::Cint, write_element_id::Cint, write_ghosts::Cint, write_curved::Cint, do_not_use_API::Cint, num_data::Cint, data::Ptr{t8_vtk_data_field_t})::Cint end """ @@ -13095,7 +13095,7 @@ int t8_forest_write_vtk (t8_forest_t forest, const char *fileprefix); ``` """ function t8_forest_write_vtk(forest, fileprefix) - @ccall libt8.t8_forest_write_vtk(forest::Cint, fileprefix::Cstring)::Cint + @ccall libt8.t8_forest_write_vtk(forest::t8_forest_t, fileprefix::Cstring)::Cint end # typedef int ( * t8_forest_iterate_face_fn ) ( const t8_forest_t forest , const t8_locidx_t ltreeid , const t8_element_t * element , const int face , void * user_data , const t8_locidx_t tree_leaf_index ) @@ -13418,7 +13418,7 @@ void t8_forest_set_profiling (t8_forest_t forest, int set_profiling); ``` """ function t8_forest_set_profiling(forest, set_profiling) - @ccall libt8.t8_forest_set_profiling(forest::Cint, set_profiling::Cint)::Cvoid + @ccall libt8.t8_forest_set_profiling(forest::t8_forest_t, set_profiling::Cint)::Cvoid end """ @@ -13430,7 +13430,7 @@ void t8_forest_compute_profile (t8_forest_t forest); ``` """ function t8_forest_compute_profile(forest) - @ccall libt8.t8_forest_compute_profile(forest::Cint)::Cvoid + @ccall libt8.t8_forest_compute_profile(forest::t8_forest_t)::Cvoid end """ @@ -13442,7 +13442,7 @@ const sc_statinfo_t * t8_forest_profile_get_adapt_stats (t8_forest_t forest); ``` """ function t8_forest_profile_get_adapt_stats(forest) - @ccall libt8.t8_forest_profile_get_adapt_stats(forest::Cint)::Ptr{sc_statinfo_t} + @ccall libt8.t8_forest_profile_get_adapt_stats(forest::t8_forest_t)::Ptr{sc_statinfo_t} end """ @@ -13454,7 +13454,7 @@ const sc_statinfo_t * t8_forest_profile_get_ghost_stats (t8_forest_t forest); ``` """ function t8_forest_profile_get_ghost_stats(forest) - @ccall libt8.t8_forest_profile_get_ghost_stats(forest::Cint)::Ptr{sc_statinfo_t} + @ccall libt8.t8_forest_profile_get_ghost_stats(forest::t8_forest_t)::Ptr{sc_statinfo_t} end """ @@ -13466,7 +13466,7 @@ const sc_statinfo_t * t8_forest_profile_get_partition_stats (t8_forest_t forest) ``` """ function t8_forest_profile_get_partition_stats(forest) - @ccall libt8.t8_forest_profile_get_partition_stats(forest::Cint)::Ptr{sc_statinfo_t} + @ccall libt8.t8_forest_profile_get_partition_stats(forest::t8_forest_t)::Ptr{sc_statinfo_t} end """ @@ -13478,7 +13478,7 @@ const sc_statinfo_t * t8_forest_profile_get_commit_stats (t8_forest_t forest); ``` """ function t8_forest_profile_get_commit_stats(forest) - @ccall libt8.t8_forest_profile_get_commit_stats(forest::Cint)::Ptr{sc_statinfo_t} + @ccall libt8.t8_forest_profile_get_commit_stats(forest::t8_forest_t)::Ptr{sc_statinfo_t} end """ @@ -13490,7 +13490,7 @@ const sc_statinfo_t * t8_forest_profile_get_balance_stats (t8_forest_t forest); ``` """ function t8_forest_profile_get_balance_stats(forest) - @ccall libt8.t8_forest_profile_get_balance_stats(forest::Cint)::Ptr{sc_statinfo_t} + @ccall libt8.t8_forest_profile_get_balance_stats(forest::t8_forest_t)::Ptr{sc_statinfo_t} end """ @@ -13502,7 +13502,7 @@ const sc_statinfo_t * t8_forest_profile_get_balance_rounds_stats (t8_forest_t fo ``` """ function t8_forest_profile_get_balance_rounds_stats(forest) - @ccall libt8.t8_forest_profile_get_balance_rounds_stats(forest::Cint)::Ptr{sc_statinfo_t} + @ccall libt8.t8_forest_profile_get_balance_rounds_stats(forest::t8_forest_t)::Ptr{sc_statinfo_t} end """ @@ -13514,7 +13514,7 @@ void t8_forest_print_profile (t8_forest_t forest); ``` """ function t8_forest_print_profile(forest) - @ccall libt8.t8_forest_print_profile(forest::Cint)::Cvoid + @ccall libt8.t8_forest_print_profile(forest::t8_forest_t)::Cvoid end """ @@ -13526,7 +13526,7 @@ double t8_forest_profile_get_adapt_time (t8_forest_t forest); ``` """ function t8_forest_profile_get_adapt_time(forest) - @ccall libt8.t8_forest_profile_get_adapt_time(forest::Cint)::Cdouble + @ccall libt8.t8_forest_profile_get_adapt_time(forest::t8_forest_t)::Cdouble end """ @@ -13538,7 +13538,7 @@ double t8_forest_profile_get_partition_time (t8_forest_t forest, int *procs_sent ``` """ function t8_forest_profile_get_partition_time(forest, procs_sent) - @ccall libt8.t8_forest_profile_get_partition_time(forest::Cint, procs_sent::Ptr{Cint})::Cdouble + @ccall libt8.t8_forest_profile_get_partition_time(forest::t8_forest_t, procs_sent::Ptr{Cint})::Cdouble end """ @@ -13550,7 +13550,7 @@ double t8_forest_profile_get_balance_time (t8_forest_t forest, int *balance_roun ``` """ function t8_forest_profile_get_balance_time(forest, balance_rounds) - @ccall libt8.t8_forest_profile_get_balance_time(forest::Cint, balance_rounds::Ptr{Cint})::Cdouble + @ccall libt8.t8_forest_profile_get_balance_time(forest::t8_forest_t, balance_rounds::Ptr{Cint})::Cdouble end """ @@ -13562,7 +13562,7 @@ double t8_forest_profile_get_ghost_time (t8_forest_t forest, t8_locidx_t *ghosts ``` """ function t8_forest_profile_get_ghost_time(forest, ghosts_sent) - @ccall libt8.t8_forest_profile_get_ghost_time(forest::Cint, ghosts_sent::Ptr{Cint})::Cdouble + @ccall libt8.t8_forest_profile_get_ghost_time(forest::t8_forest_t, ghosts_sent::Ptr{Cint})::Cdouble end """ @@ -13574,7 +13574,7 @@ double t8_forest_profile_get_ghostexchange_waittime (t8_forest_t forest); ``` """ function t8_forest_profile_get_ghostexchange_waittime(forest) - @ccall libt8.t8_forest_profile_get_ghostexchange_waittime(forest::Cint)::Cdouble + @ccall libt8.t8_forest_profile_get_ghostexchange_waittime(forest::t8_forest_t)::Cdouble end """ @@ -13586,7 +13586,7 @@ double t8_forest_profile_get_cmesh_offsets_runtime (t8_forest_t forest); ``` """ function t8_forest_profile_get_cmesh_offsets_runtime(forest) - @ccall libt8.t8_forest_profile_get_cmesh_offsets_runtime(forest::Cint)::Cdouble + @ccall libt8.t8_forest_profile_get_cmesh_offsets_runtime(forest::t8_forest_t)::Cdouble end """ @@ -13598,7 +13598,7 @@ double t8_forest_profile_get_forest_offsets_runtime (t8_forest_t forest); ``` """ function t8_forest_profile_get_forest_offsets_runtime(forest) - @ccall libt8.t8_forest_profile_get_forest_offsets_runtime(forest::Cint)::Cdouble + @ccall libt8.t8_forest_profile_get_forest_offsets_runtime(forest::t8_forest_t)::Cdouble end """ @@ -13610,7 +13610,7 @@ double t8_forest_profile_get_first_descendant_runtime (t8_forest_t forest); ``` """ function t8_forest_profile_get_first_descendant_runtime(forest) - @ccall libt8.t8_forest_profile_get_first_descendant_runtime(forest::Cint)::Cdouble + @ccall libt8.t8_forest_profile_get_first_descendant_runtime(forest::t8_forest_t)::Cdouble end """ @@ -16348,7 +16348,7 @@ void t8_forest_init_search (t8_forest_search_c_wrapper search, t8_search_element ``` """ function t8_forest_init_search(search, element_callback, forest) - @ccall libt8.t8_forest_init_search(search::t8_forest_search_c_wrapper, element_callback::t8_search_element_callback_c_wrapper, forest::Cint)::Cvoid + @ccall libt8.t8_forest_init_search(search::t8_forest_search_c_wrapper, element_callback::t8_search_element_callback_c_wrapper, forest::t8_forest_t)::Cvoid end """ @@ -16360,7 +16360,7 @@ void t8_forest_search_update_forest (t8_forest_search_c_wrapper search, const t8 ``` """ function t8_forest_search_update_forest(search, forest) - @ccall libt8.t8_forest_search_update_forest(search::t8_forest_search_c_wrapper, forest::Cint)::Cvoid + @ccall libt8.t8_forest_search_update_forest(search::t8_forest_search_c_wrapper, forest::t8_forest_t)::Cvoid end """ @@ -16426,7 +16426,7 @@ void t8_forest_init_search_with_queries (t8_forest_search_with_queries_c_wrapper ``` """ function t8_forest_init_search_with_queries(search_with_queries, element_callback, queries_callback, queries, num_queries, forest) - @ccall libt8.t8_forest_init_search_with_queries(search_with_queries::t8_forest_search_with_queries_c_wrapper, element_callback::t8_search_element_callback_c_wrapper, queries_callback::t8_search_queries_callback_c_wrapper, queries::Ptr{Ptr{Cvoid}}, num_queries::Csize_t, forest::Cint)::Cvoid + @ccall libt8.t8_forest_init_search_with_queries(search_with_queries::t8_forest_search_with_queries_c_wrapper, element_callback::t8_search_element_callback_c_wrapper, queries_callback::t8_search_queries_callback_c_wrapper, queries::Ptr{Ptr{Cvoid}}, num_queries::Csize_t, forest::t8_forest_t)::Cvoid end """ @@ -16438,7 +16438,7 @@ void t8_forest_search_with_queries_update_forest (t8_forest_search_with_queries_ ``` """ function t8_forest_search_with_queries_update_forest(search_with_queries, forest) - @ccall libt8.t8_forest_search_with_queries_update_forest(search_with_queries::t8_forest_search_with_queries_c_wrapper, forest::Cint)::Cvoid + @ccall libt8.t8_forest_search_with_queries_update_forest(search_with_queries::t8_forest_search_with_queries_c_wrapper, forest::t8_forest_t)::Cvoid end """ @@ -16522,7 +16522,7 @@ void t8_forest_init_search_with_batched_queries (t8_forest_search_with_batched_q ``` """ function t8_forest_init_search_with_batched_queries(search_with_queries, element_callback, queries_callback, queries, num_queries, forest) - @ccall libt8.t8_forest_init_search_with_batched_queries(search_with_queries::t8_forest_search_with_batched_queries_c_wrapper, element_callback::t8_search_element_callback_c_wrapper, queries_callback::t8_search_batched_queries_callback_c_wrapper, queries::Ptr{Ptr{Cvoid}}, num_queries::Csize_t, forest::Cint)::Cvoid + @ccall libt8.t8_forest_init_search_with_batched_queries(search_with_queries::t8_forest_search_with_batched_queries_c_wrapper, element_callback::t8_search_element_callback_c_wrapper, queries_callback::t8_search_batched_queries_callback_c_wrapper, queries::Ptr{Ptr{Cvoid}}, num_queries::Csize_t, forest::t8_forest_t)::Cvoid end """ @@ -16534,7 +16534,7 @@ void t8_forest_search_with_batched_queries_update_forest ( t8_forest_search_with ``` """ function t8_forest_search_with_batched_queries_update_forest(search_with_queries, forest) - @ccall libt8.t8_forest_search_with_batched_queries_update_forest(search_with_queries::t8_forest_search_with_batched_queries_c_wrapper, forest::Cint)::Cvoid + @ccall libt8.t8_forest_search_with_batched_queries_update_forest(search_with_queries::t8_forest_search_with_batched_queries_c_wrapper, forest::t8_forest_t)::Cvoid end """ From c7635799a08541af48db828eb8815da43aae56a8 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Thu, 11 Dec 2025 17:01:28 +0100 Subject: [PATCH 08/24] update adapt callback --- src/T8code.jl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/T8code.jl b/src/T8code.jl index 87a8148..1075d53 100644 --- a/src/T8code.jl +++ b/src/T8code.jl @@ -262,14 +262,15 @@ function t8_free(ptr) Libt8.sc_free(t8_get_package_id(), ptr) end -# typedef int (*t8_forest_adapt_t) (t8_forest_t forest, -# t8_forest_t forest_from, -# t8_locidx_t which_tree, -# t8_locidx_t lelement_id, -# t8_eclass_scheme_c *ts, -# const int is_family, -# const int num_elements, -# t8_element_t *elements[]); +# typedef int (*t8_forest_adapt_t) (t8_forest_t forest, +# t8_forest_t forest_from, +# t8_locidx_t which_tree, +# const t8_eclass_t tree_class, +# t8_locidx_t lelement_id, +# const t8_scheme_c *scheme, +# const int is_family, +# const int num_elements, +# t8_element_t *elements[]); """ @t8_adapt_callback(callback) @@ -278,8 +279,8 @@ signature required for callback functions in [`t8_forest_adapt`](@ref). """ macro t8_adapt_callback(callback) :(@cfunction($callback, Cint, - (Ptr{t8_forest}, Ptr{t8_forest}, t8_locidx_t, t8_locidx_t, - Ptr{t8_eclass_scheme}, Cint, Cint, Ptr{Ptr{t8_element}}))) + (Ptr{t8_forest}, Ptr{t8_forest}, t8_locidx_t, t8_eclass_t, t8_locidx_t, + Ptr{t8_scheme}, Cint, Cint, Ptr{Ptr{t8_element}}))) end # typedef void (*t8_forest_replace_t) (t8_forest_t forest_old, From 40d75ba2377b31db4295aba66c68782814e24ec1 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Tue, 6 Jan 2026 16:00:22 +0100 Subject: [PATCH 09/24] document upgrade process --- dev/README.md | 83 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 7 deletions(-) diff --git a/dev/README.md b/dev/README.md index c906bf7..62924d3 100644 --- a/dev/README.md +++ b/dev/README.md @@ -1,21 +1,90 @@ -# Building Julia bindings of `t8code` with Clang.jl +# Generating Julia bindings of `t8code` with `Clang.jl` -The general process for creating bindings with Clang.jl is as follows: +Working with or deploying a new release of `T8code.jl` involves creating a new build of the +binary package `t8code_jll.jl`, and generating new bindings in `T8code.jl`. + + +## Updating `t8code_jll.jl` + +### For local development + +If you are developing `t8code`, you will probably want to use your locally compiled version +instead of `t8code_jll.jl`, as documented here: +https://github.com/DLR-AMR/T8code.jl?tab=readme-ov-file#using-a-custom-version-of-mpi-andor-t8code + + +### For deployment + +If you want to provide a new `t8code` release for the Julia community, you need to trigger a +new build of the `t8code_jll.jl` bindary package. Building the binaries happens via +BinaryBuilder, documented here: +https://docs.binarybuilder.org/stable/. +It boils down to checking out +https://github.com/JuliaPackaging/Yggdrasil/tree/master/T/t8code, +editing `build_tarballs.jl` to at least reflect the latest version, tarball URL, and hash, +committing, and opening a pull request. + +Even a draft PR will already trigger the buildkite +pipelines. Check the builds for any errors. Successful runs will produce the binary +packages as artifacts. You can find an URL to such an artifact in the buildkite output, +along with its tree hash and SHA256 hash, which can be used in `Artifacts.toml` described +below. + +If you instead want to run BinaryBuilder locally you can do so by executing + +```shell +julia +1.7 build_tarballs.jl --debug --verbose x86_64-linux-gnu --deploy=local +``` + +This requires a local Julia installation and Julia version 1.7. You can use any other +eligible platform triple instead of `x86_64-linux-gnu`. Adding `--deploy=local` will add +the created binaries to your local Julia aritfacts folder. + + +## Updating `Tcode.jl` + +Bindings are created using `Clang.jl`. The general process is as follows: 1. Create a `generator.jl` file with the relevant Julia code (not a lot). 2. Create a corresponding `generator.toml` file with certain settings. -3. Run `julia generator.jl` to create new file `Libt8.jl`. +3. Run `julia generator.jl` to create a new file `Libt8.jl`. 4. Apply manual fixes using `./fixes.sh` 5. Run `julia Libt8.jl`. 6. Get error(s). -7. Try to finagle something with `generator.toml`, `prologue.jl`/`epilogue.jl`, +7. Try to finagle something with `generator.toml`, `prologue.jl`, `epilogue.jl`, or `fixes.sh`. 8. Go back to 3. -To generate new bindings, run +The crucial ingredients are the `t8code` header files, which are expected in a subdirectory +`t8code_include` of the folder of this README. You have the following options: +- If you are developing `t8code` locally, you can copy and rename `t8code`'s `include` + directory from its current prefix path. You will have to comment lines 5 and 6 (dealing with artifacts) in `generator.jl` then. +- If your pull request to Yggdrasil has already been merged, you can find the newly built + binary packages at https://github.com/JuliaBinaryWrappers/t8code_jll.jl/releases. Pick an + asset and use its URL and hash to replace the current settings in `Artifacts.toml`. +- If your pull request has not yet been accepted, you can instead use artifacts of the + buildkite pipeline, see above. +- If you ran BindaryBuilder locally, you can somehow use your local atifacts. But how? + +In any case run ```shell julia --project generator.jl && ./fixes.sh ``` -to create a new `Libt8.jl` file. +next. If all goes well, move the new `Libt8.jl` file to `src/` and adapt the compat entry +in `Project.toml` to reflect the new version of `t8code_jll.jl`. + +At this point you can test your new `T8code.jl` version locally, e.g. by creating a +subdirectory `run` at the `T8code.jl` root folder, and from there executing + +```shell +julia --project=. + +julia> using Pkg +julia> Pkg.develop(path="..") +julia> Pkg.test("T8code") +``` + +If actually all went well, go ahead and open a pull request. -More information can be found in https://github.com/trixi-framework/P4est.jl +Once this pull request has been merged, downstream packages can start adopting your new +t8code release! From ad86589f34933871f8b94efb7e98345b9f9956ab Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Tue, 6 Jan 2026 17:09:40 +0100 Subject: [PATCH 10/24] update generator.toml and fixes.sh move everything to ignore to generator.toml, try to keep manual fixes list short --- dev/epilogue.jl | 0 dev/fixes.sh | 32 +--------- dev/generator.toml | 150 ++++++++++++++++++++++++++++++++------------- 3 files changed, 108 insertions(+), 74 deletions(-) delete mode 100644 dev/epilogue.jl diff --git a/dev/epilogue.jl b/dev/epilogue.jl deleted file mode 100644 index e69de29..0000000 diff --git a/dev/fixes.sh b/dev/fixes.sh index f344e78..84efb75 100755 --- a/dev/fixes.sh +++ b/dev/fixes.sh @@ -21,36 +21,8 @@ sed -i "s/t8_forest_get_mpicomm(forest::t8_forest_t)::Cint/t8_forest_get_mpicomm # Remove struct t8_forest definition and replace by forward declaration sed -i -z 's/\nstruct t8_forest.*stats_computed::Cint\nend/\n# This struct is not supposed to be read and modified directly.\n# Besides, there is a circular dependency with `t8_forest_t`\n# leading to an error output by Julia.\nmutable struct t8_forest end/g' "${LIB_JL}" +# Fix forest type sed -i "s/forest::Cint/forest::t8_forest_t/" "${LIB_JL}" -# Remove Fortran macros -sed -i "/INTEGER(KIND/d" "${LIB_JL}" - -# Remove local arrays -sed -i "/T8_.*_VALUES/d" "${LIB_JL}" - -# Remove misc -sed -i "/T8_VERSION_POINT/d" "${LIB_JL}" - -sed -i "/P4EST_GLOBAL_NOTICE/d" "${LIB_JL}" -sed -i "/P4EST_NOTICE/d" "${LIB_JL}" - -sed -i "/_sc_const/d" "${LIB_JL}" -sed -i "/_sc_restrict/d" "${LIB_JL}" - -# Remove MPI macros not available in MPI.jl -sed -i "/sc_MPI_PACKED/d" "${LIB_JL}" -sed -i "/sc_MPI_Pack/d" "${LIB_JL}" -sed -i "/sc_MPI_Unpack/d" "${LIB_JL}" -sed -i "/sc_MPI_DOUBLE_INT/d" "${LIB_JL}" - -sed -i "/= MPI_MODE_/d" "${LIB_JL}" -sed -i "/= MPI_SEEK_/d" "${LIB_JL}" -sed -i "/= MPI_ERR_/d" "${LIB_JL}" -sed -i "/= MPI_MAX_/d" "${LIB_JL}" -sed -i "/= MPI_Type_/d" "${LIB_JL}" -sed -i "/= MPI_Offset/d" "${LIB_JL}" -sed -i "/= MPI_File_/d" "${LIB_JL}" -sed -i "/= MPI_Aint/d" "${LIB_JL}" - +# Rename remaining MPI macros sed -i "s/= MPI_/= MPI./" "${LIB_JL}" diff --git a/dev/generator.toml b/dev/generator.toml index 95edc31..cb8fb06 100644 --- a/dev/generator.toml +++ b/dev/generator.toml @@ -29,14 +29,13 @@ module_name = "Libt8" # using jll_pkg_name # export jll_pkg_name # We do not set this option since we want to customize it in prologue.jl. -# jll_pkg_name = "P4est_jll" +# jll_pkg_name = "t8code_jll" jll_pkg_name = "" # for packages that have extra JLL package dependencies jll_pkg_extra = [] # identifiers that starts with the string listed in this entry will be exported. -# export_symbol_prefixes = ["t8_", "p4est_", "p6est_", "p8est_", "sc_", "T8_", "P4EST_", "P6EST_", "P8EST_", "SC_"] export_symbol_prefixes = ["t8_", "T8_"] # the code in the following file will be copy-pasted to `output_file_path` before the generated code. @@ -45,28 +44,42 @@ prologue_file_path = "./prologue.jl" # the code in the following file will be copy-pasted to `output_file_path` after the generated code. # this is often used for applying custom patches. -epilogue_file_path = "./epilogue.jl" +epilogue_file_path = "" # node with an id in the `output_ignorelist` will be ignored in the printing passes. # this is very useful for custom editing. output_ignorelist = [ "_sc_restrict", - "sc_extern_c_hack_3", - "sc_extern_c_hack_4", + "SC_GCC_VERSION", "SC_EXTERN_C_BEGIN", "SC_EXTERN_C_END", - "SC_GCC_VERSION", - "PLATFORM_COMPILER_VERSION", - "__PLATFORM_COMPILER_GNU_VERSION_STR", - "_p4est_const", - "sc_MPI_2INT", "sc_MPI_SUCCESS", + "sc_MPI_ERR_ARG", + "sc_MPI_ERR_COUNT", + "sc_MPI_ERR_UNKNOWN", "sc_MPI_ERR_OTHER", + "sc_MPI_ERR_NO_MEM", + "sc_MPI_MAX_ERROR_STRING", + "sc_MPI_ERR_FILE", + "sc_MPI_ERR_NOT_SAME", + "sc_MPI_ERR_AMODE", + "sc_MPI_ERR_UNSUPPORTED_DATAREP", + "sc_MPI_ERR_UNSUPPORTED_OPERATION", + "sc_MPI_ERR_NO_SUCH_FILE", + "sc_MPI_ERR_FILE_EXISTS", + "sc_MPI_ERR_BAD_FILE", + "sc_MPI_ERR_ACCESS", + "sc_MPI_ERR_NO_SPACE", + "sc_MPI_ERR_QUOTA", + "sc_MPI_ERR_READ_ONLY", + "sc_MPI_ERR_FILE_IN_USE", + "sc_MPI_ERR_DUP_DATAREP", + "sc_MPI_ERR_CONVERSION", + "sc_MPI_ERR_IO", + "sc_MPI_ERR_LASTCODE", + "sc_MPI_Aint", "sc_MPI_COMM_NULL", - # "sc_MPI_COMM_WORLD", - # "sc_MPI_COMM_SELF", "sc_MPI_COMM_TYPE_SHARED", - "sc_MPI_GROUP", "sc_MPI_GROUP_NULL", "sc_MPI_GROUP_EMPTY", "sc_MPI_IDENT", @@ -78,24 +91,11 @@ output_ignorelist = [ "sc_MPI_STATUS_IGNORE", "sc_MPI_STATUSES_IGNORE", "sc_MPI_REQUEST_NULL", - "sc_MPI_INFO_NULL", "sc_MPI_DATATYPE_NULL", - # "sc_MPI_CHAR", - # "sc_MPI_SIGNED_CHAR", - # "sc_MPI_UNSIGNED_CHAR", - # "sc_MPI_BYTE", - # "sc_MPI_SHORT", - # "sc_MPI_UNSIGNED_SHORT", - # "sc_MPI_INT", - # "sc_MPI_UNSIGNED", - # "sc_MPI_LONG", - # "sc_MPI_UNSIGNED_LONG", - # "sc_MPI_LONG_LONG_INT", - # "sc_MPI_UNSIGNED_LONG_LONG", - # "sc_MPI_FLOAT", - # "sc_MPI_DOUBLE", "sc_MPI_LONG_DOUBLE", - "sc_MPI_Op", + "sc_MPI_2INT", + "sc_MPI_DOUBLE_INT", + "sc_MPI_PACKED", "sc_MPI_OP_NULL", "sc_MPI_MAX", "sc_MPI_MIN", @@ -112,7 +112,10 @@ output_ignorelist = [ "sc_MPI_PROD", "sc_MPI_UNDEFINED", "sc_MPI_KEYVAL_INVALID", + "sc_MPI_Op", + "sc_MPI_Request", "sc_MPI_Status", + "sc_MPI_INFO_NULL", "sc_MPI_Init", "sc_MPI_Finalize", "sc_MPI_Abort", @@ -155,7 +158,6 @@ output_ignorelist = [ "sc_MPI_Allreduce", "sc_MPI_Scan", "sc_MPI_Exscan", - "sc_MPI_Request", "sc_MPI_Recv", "sc_MPI_Irecv", "sc_MPI_Send", @@ -167,11 +169,60 @@ output_ignorelist = [ "sc_MPI_Wait", "sc_MPI_Waitsome", "sc_MPI_Waitall", - "sc_MPI_Init_thread", + "sc_MPI_Type_size", + "sc_MPI_Pack", + "sc_MPI_Unpack", + "sc_MPI_Pack_size", + "sc_MPI_Aint_diff", "sc_MPI_THREAD_SINGLE", "sc_MPI_THREAD_FUNNELED", "sc_MPI_THREAD_SERIALIZED", "sc_MPI_THREAD_MULTIPLE", + "sc_MPI_Init_thread", + "sc_MPI_MODE_RDONLY", + "sc_MPI_MODE_RDWR", + "sc_MPI_MODE_WRONLY", + "sc_MPI_MODE_CREATE", + "sc_MPI_MODE_EXCL", + "sc_MPI_MODE_DELETE_ON_CLOSE", + "sc_MPI_MODE_UNIQUE_OPEN", + "sc_MPI_MODE_SEQUENTIAL", + "sc_MPI_MODE_APPEND", + "sc_MPI_SEEK_SET", + "sc_MPI_SEEK_CUR", + "sc_MPI_SEEK_END", + "sc_MPI_Offset", + "sc_MPI_File_open", + "sc_MPI_File_close", + "sc_MPI_File_get_view", + "sc_MPI_File_set_view", + "sc_MPI_File_write_all", + "sc_MPI_File_read_all", + "sc_MPI_File_write_at_all", + "sc_MPI_File_read_at_all", + "sc_MPI_File_get_size", + "sc_MPI_File_set_size", + "t8_const", + "t8_restrict", + "T8_ECLASS_TO_DIMENSION_VALUES", + "T8_ECLASS_NUM_FACES_VALUES", + "T8_ECLASS_MAX_NUM_FACES_VALUES", + "T8_ECLASS_MAX_NUM_CHILDREN_VALUES", + "T8_REFERENCE_FACE_NORMAL_TET_VALUES", + "T8_ECLASS_NUM_VERTICES_VALUES", + "T8_ECLASS_NUM_EDGES_VALUES", + "T8_ECLASS_VTK_TYPE_VALUES", + "T8_ECLASS_TO_STRING_VALUES", + "T8_VERSION_POINT_STRING", + "_p4est_const", + "P4EST_F90_QCOORD", + "P4EST_F90_TOPIDX", + "P4EST_F90_LOCIDX", + "P4EST_F90_GLOIDX", + "P4EST_GLOBAL_NOTICE", + "P4EST_GLOBAL_NOTICEF", + "P4EST_NOTICE", + "P4EST_NOTICEF", ] # Julia's `@enum` do not allow duplicated values, so by default, C enums are translated to @@ -195,6 +246,9 @@ use_deterministic_symbol = true # if you'd like to generate all of the symbols in the system headers, please set this option to false. is_local_header_only = true +# set this option to false if you'd like to ignore the symbols(even if necessary) in the system headers. +generate_isystem_symbols = true + # if this option is set to true, C code with a style of # ```c # typedef struct { @@ -216,6 +270,9 @@ is_local_header_only = true # ``` smart_de_anonymize = true +# if set to true, static functions will be ignored +skip_static_functions = false + # EXPERIMENTAL # if this option is set to true, those structs that are not necessary to be an # immutable struct will be generated as a mutable struct. @@ -242,8 +299,17 @@ auto_mutability_includelist = [] # note: by default, Clang only parses doxygen comment, pass `-fparse-all-comments` to Clang in order to parse non-doxygen comments. extract_c_comment_style = "doxygen" +# Pass a function to explicitly generate documentation. It will be called like +# `callback_documentation(node::ExprNode, doc::Vector{String})` if it is +# set. The `doc` argument will contain the docs parsed from the headers if +# `extract_c_comment_style` is set, otherwise it will be an empty vector. +# +# Do *not* set this in the TOML file, it should be set in the generator script +# to a function that takes in an ExprNode and returns a String[] (string +# vector). +# callback_documentation = "" + # if set to true, single line comment will be printed as """comment""" instead of """\ncomment\n""" -# fold_single_line_comment = false fold_single_line_comment = true # if set to "outofline", documentation of struct fields will be collected at the "Fields" section of the struct @@ -277,9 +343,13 @@ opaque_as_mutable_struct = true use_ccall_macro = true # if true, variadic functions are wrapped with `@ccall` macro. Otherwise variadic functions are ignored. -wrap_variadic_function = true +wrap_variadic_function = false -# generate getproperty/setproperty! methods for the types in the following list +# Generate getproperty/setproperty! methods for the types in the following list. +# Warning: the generated methods will only work on the architecture that they +# were generated on. i.e. if you generate them on a 64bit machine they are not +# guaranteed to work on 32bit machines. See +# https://github.com/JuliaInterop/Clang.jl/issues/512 for more details. field_access_method_list = [] # the generator will prefix the function argument names in the following list with a "_" to @@ -291,21 +361,13 @@ function_argument_conflict_symbols = [] add_record_constructors = [] [codegen.macro] -# it‘s highly recommended to set this entry to "basic". +# it's highly recommended to set this entry to "basic". # if you'd like to skip all of the macros, please set this entry to "disable". # if you'd like to translate function-like macros to Julia, please set this entry to "aggressive". macro_mode = "basic" # function-like macros in the following list will always be translated. -functionlike_macro_includelist = [ - "P4EST_QUADRANT_LEN", - "P4EST_QUADRANT_MASK", - "P4EST_LAST_OFFSET", - "P8EST_QUADRANT_LEN", - "P8EST_QUADRANT_MASK", - "P8EST_LAST_OFFSET" - # "CINDEX_VERSION_ENCODE", -] +functionlike_macro_includelist = [] # if true, the generator prints the following message as comments. # "# Skipping MacroDefinition: ..." From 999b6f96c6303bcd5536e357f6e06359367b577d Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Tue, 6 Jan 2026 17:23:51 +0100 Subject: [PATCH 11/24] try without variadic --- src/Libt8.jl | 171 ++++----------------------------------------------- 1 file changed, 11 insertions(+), 160 deletions(-) diff --git a/src/Libt8.jl b/src/Libt8.jl index 73a5891..6b62402 100644 --- a/src/Libt8.jl +++ b/src/Libt8.jl @@ -2,11 +2,6 @@ module Libt8 using CEnum: CEnum, @cenum -to_c_type(t::Type) = t -to_c_type_pairs(va_list) = map(enumerate(to_c_type.(va_list))) do (ind, type) - :(va_list[$ind]::$type) -end - using t8code_jll: t8code_jll export t8code_jll @@ -107,11 +102,6 @@ function sc_abort_verbose(filename, lineno, msg) @ccall libt8.sc_abort_verbose(filename::Cstring, lineno::Cint, msg::Cstring)::Cvoid end -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function sc_abort_verbosef(filename, lineno, fmt, va_list...) - :(@ccall(libt8.sc_abort_verbosef(filename::Cstring, lineno::Cint, fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - """ sc_malloc(package, size) @@ -190,11 +180,6 @@ function sc_log(filename, lineno, package, category, priority, msg) @ccall libt8.sc_log(filename::Cstring, lineno::Cint, package::Cint, category::Cint, priority::Cint, msg::Cstring)::Cvoid end -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function sc_logf(filename, lineno, package, category, priority, fmt, va_list...) - :(@ccall(libt8.sc_logf(filename::Cstring, lineno::Cint, package::Cint, category::Cint, priority::Cint, fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - """ sc_array @@ -978,11 +963,6 @@ function sc_strcopy(dest, size, src) @ccall libt8.sc_strcopy(dest::Cstring, size::Csize_t, src::Cstring)::Cvoid end -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function sc_snprintf(str, size, format, va_list...) - :(@ccall(libt8.sc_snprintf(str::Cstring, size::Csize_t, format::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - """ sc_version() @@ -2936,11 +2916,6 @@ Communication tags used internal to t8code. T8_MPI_TAG_LAST = 302 end -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function t8_logf(category, priority, fmt, va_list...) - :(@ccall(libt8.t8_logf(category::Cint, priority::Cint, fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - """ t8_log_indent_push() @@ -2969,46 +2944,6 @@ function t8_log_indent_pop() @ccall libt8.t8_log_indent_pop()::Cvoid end -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function t8_global_errorf(fmt, va_list...) - :(@ccall(libt8.t8_global_errorf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function t8_global_essentialf(fmt, va_list...) - :(@ccall(libt8.t8_global_essentialf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function t8_global_productionf(fmt, va_list...) - :(@ccall(libt8.t8_global_productionf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function t8_global_infof(fmt, va_list...) - :(@ccall(libt8.t8_global_infof(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function t8_infof(fmt, va_list...) - :(@ccall(libt8.t8_infof(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function t8_productionf(fmt, va_list...) - :(@ccall(libt8.t8_productionf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function t8_debugf(fmt, va_list...) - :(@ccall(libt8.t8_debugf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function t8_errorf(fmt, va_list...) - :(@ccall(libt8.t8_errorf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - """ t8_set_external_log_fcn(log_fcn) @@ -5583,11 +5518,6 @@ Open modes for sc_io_open SC_IO_WRITE_APPEND = 2 end -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function sc_io_sink_new(iotype, iomode, ioencode, va_list...) - :(@ccall(libt8.sc_io_sink_new(iotype::Cint, iomode::Cint, ioencode::Cint; $(to_c_type_pairs(va_list)...))::Ptr{sc_io_sink_t})) - end - """ sc_io_sink_destroy(sink) @@ -5683,11 +5613,6 @@ function sc_io_sink_align(sink, bytes_align) @ccall libt8.sc_io_sink_align(sink::Ptr{sc_io_sink_t}, bytes_align::Csize_t)::Cint end -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function sc_io_source_new(iotype, ioencode, va_list...) - :(@ccall(libt8.sc_io_source_new(iotype::Cint, ioencode::Cint; $(to_c_type_pairs(va_list)...))::Ptr{sc_io_source_t})) - end - """ sc_io_source_destroy(source) @@ -10386,11 +10311,6 @@ function sc_keyvalue_new() @ccall libt8.sc_keyvalue_new()::Ptr{sc_keyvalue_t} end -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function sc_keyvalue_newf(dummy, va_list...) - :(@ccall(libt8.sc_keyvalue_newf(dummy::Cint; $(to_c_type_pairs(va_list)...))::Ptr{sc_keyvalue_t})) - end - """ sc_keyvalue_destroy(kv) @@ -15666,11 +15586,6 @@ function sc_flops_count(fi) @ccall libt8.sc_flops_count(fi::Ptr{sc_flopinfo_t})::Cvoid end -# automatic type deduction for variadic arguments may not be what you want, please use with caution -@generated function sc_flops_shotv(fi, va_list...) - :(@ccall(libt8.sc_flops_shotv(fi::Ptr{sc_flopinfo_t}; $(to_c_type_pairs(va_list)...))::Cvoid)) - end - mutable struct sc_options end """The options data structure is opaque.""" @@ -17143,29 +17058,7 @@ const SC_VERSION_MINOR = 0 const SC_VERSION_POINT = 0 - - - - - - - - - - - - - - - - - - - - - - - +# Skipping MacroDefinition: _sc_const const const sc_MPI_COMM_WORLD = MPI.COMM_WORLD @@ -17201,8 +17094,6 @@ const sc_MPI_FLOAT = MPI.FLOAT const sc_MPI_DOUBLE = MPI.DOUBLE - - const sc_MPI_Comm = MPI.Comm const sc_MPI_Group = MPI.Group @@ -17211,38 +17102,10 @@ const sc_MPI_Datatype = MPI.Datatype const sc_MPI_Info = MPI.Info - - - - - - - - - - - - - - - - - - const sc_MPI_File = MPI.File const sc_MPI_FILE_NULL = MPI.FILE_NULL - - - - - - - - - - const SC_EPS = 2.220446049250313e-16 const SC_1000_EPS = 1000.0 * 2.220446049250313e-16 @@ -17275,8 +17138,6 @@ const SC_LP_SILENT = 9 const SC_LP_THRESHOLD = SC_LP_INFO - - const T8_MPI_LOCIDX = sc_MPI_INT const T8_LOCIDX_MAX = INT32_MAX @@ -17307,42 +17168,42 @@ const T8_ECLASS_MAX_CORNERS = 8 const T8_ECLASS_MAX_DIM = 3 - - - - +# Skipping MacroDefinition: T8_FACE_VERTEX_TO_TREE_VERTEX_VALUES { { { - 1 } } , /* vertex */ { { 0 } , { 1 } } , /* line */ { { 0 , 2 } , { 1 , 3 } , { 0 , 1 } , { 2 , 3 } } , /* quad */ { { 1 , 2 } , { 0 , 2 } , { 0 , 1 } } , /* triangle */ { { 0 , 2 , 4 , 6 } , { 1 , 3 , 5 , 7 } , { 0 , 1 , 4 , 5 } , { 2 , 3 , 6 , 7 } , { 0 , 1 , 2 , 3 } , { 4 , 5 , 6 , 7 } } , /* hex */ { { 1 , 2 , 3 } , { 0 , 2 , 3 } , { 0 , 1 , 3 } , { 0 , 1 , 2 } } , /* tet */ { { 1 , 2 , 4 , 5 } , { 0 , 2 , 3 , 5 } , { 0 , 1 , 3 , 4 } , { 0 , 1 , 2 } , { 3 , 4 , 5 } } , /* prism */ { { 0 , 2 , 4 } , { 1 , 3 , 4 } , { 0 , 1 , 4 } , { 2 , 3 , 4 } , { 0 , 1 , 2 , 3 } } /* pyramid */ \ #} +# Skipping MacroDefinition: T8_FACE_EDGE_TO_TREE_EDGE_VALUES { { { - 1 } } , /* vertex */ { { 0 } } , /* line */ { { 0 } , { 1 } , { 2 } , { 3 } } , /* quad */ { { 0 } , { 1 } , { 2 } } , /* triangle */ { { 8 , 10 , 4 , 6 } , { 9 , 11 , 5 , 7 } , { 8 , 9 , 0 , 2 } , { 10 , 11 , 1 , 3 } , { 4 , 5 , 0 , 1 } , { 6 , 7 , 2 , 3 } } , /* hex */ { { 3 , 4 , 5 } , { 1 , 2 , 5 } , { 0 , 2 , 4 } , { 0 , 1 , 3 } } , /* tet */ { { 0 , 7 , 3 , 6 } , { 1 , 8 , 4 , 7 } , { 2 , 6 , 5 , 8 } , { 0 , 1 , 2 } , { 3 , 4 , 5 } } , /* prism */ { { - 1 } } , /* pyramid */ \ #} +# Skipping MacroDefinition: T8_FACE_TO_EDGE_NEIGHBOR_VALUES { { { - 1 } } , /* vertex */ { { - 1 } } , /* line */ { { 2 , 3 } , { 2 , 3 } , { 0 , 1 } , { 0 , 1 } } , /* quad */ { { 2 , 1 } , { 2 , 0 } , { 1 , 0 } } , /* triangle */ { { 0 , 1 , 2 , 3 } , { 0 , 1 , 2 , 3 } , { 4 , 5 , 6 , 7 } , { 4 , 5 , 6 , 7 } , { 8 , 9 , 10 , 11 } , { 8 , 9 , 10 , 11 } } , /* hex */ { { 0 , 1 , 2 } , { 0 , 3 , 4 } , { 1 , 3 , 5 } , { 2 , 4 , 5 } } , /* tet */ { { 1 , 2 , 4 , 5 } , { 0 , 2 , 3 , 5 } , { 0 , 1 , 3 , 4 } , { 6 , 7 , 8 } , { 6 , 7 , 8 } } , /* prism */ { { - 1 } } , /* pyramid */ \ #} +# Skipping MacroDefinition: T8_EDGE_VERTEX_TO_TREE_VERTEX_VALUES { { { - 1 } } , /* vertex */ { { 0 } , { 1 } } , /* line */ { { 0 , 2 } , { 1 , 3 } , { 0 , 1 } , { 2 , 3 } } , /* quad */ { { 1 , 2 } , { 0 , 2 } , { 0 , 1 } } , /* triangle */ { { 0 , 1 } , { 2 , 3 } , { 4 , 5 } , { 6 , 7 } , { 0 , 2 } , { 1 , 3 } , { 4 , 6 } , { 5 , 7 } , { 0 , 4 } , { 1 , 5 } , { 2 , 6 } , { 3 , 7 } } , /* hex */ { { 0 , 1 } , { 0 , 2 } , { 0 , 3 } , { 1 , 2 } , { 1 , 3 } , { 2 , 3 } } , /* tet */ { { 1 , 2 } , { 0 , 2 } , { 0 , 1 } , { 4 , 5 } , { 3 , 5 } , { 3 , 4 } , { 1 , 4 } , { 2 , 5 } , { 0 , 3 } } , /* prism */ { { - 1 } } , /* pyramid */ \ #} +# Skipping MacroDefinition: T8_EDGE_TO_FACE_VALUES { { { - 1 } } , /* vertex */ { { 0 } } , /* line */ { { 0 } , { 1 } , { 2 } , { 3 } } , /* quad */ { { 0 } , { 1 } , { 2 } } , /* triangle */ { { 2 , 4 } , { 3 , 4 } , { 2 , 5 } , { 3 , 5 } , { 0 , 4 } , { 1 , 4 } , { 0 , 5 } , { 1 , 5 } , { 0 , 2 } , { 1 , 2 } , { 0 , 3 } , { 1 , 3 } } , /* hex */ { { 2 , 3 } , { 1 , 3 } , { 1 , 2 } , { 0 , 3 } , { 0 , 2 } , { 0 , 1 } } , /* tet */ { { 0 , 3 } , { 1 , 3 } , { 2 , 3 } , { 0 , 4 } , { 1 , 4 } , { 2 , 4 } , { 0 , 2 } , { 0 , 1 } , { 1 , 2 } } , /* prism */ { { - 1 } } , /* pyramid */ \ #} +# Skipping MacroDefinition: T8_ECLASS_FACE_ORIENTATION_VALUES { { 0 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* vertex */ { 0 , 0 , - 1 , - 1 , - 1 , - 1 } , /* line */ { 0 , 0 , 0 , 0 , - 1 , - 1 } , /* quad */ { 0 , 0 , 0 , - 1 , - 1 , - 1 } , /* triangle */ { 0 , 1 , 1 , 0 , 0 , 1 } , /* hex */ { 0 , 1 , 0 , 1 , - 1 , - 1 } , /* tet */ { 1 , 0 , 1 , 0 , 1 , - 1 } , /* prism */ { 0 , 1 , 1 , 0 , 0 , - 1 } /* pyramid */ \ #} - - - - +# Skipping MacroDefinition: T8_ECLASS_VTK_TO_T8_CORNER_NUMBER_VALUES { { 0 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* vertex */ { 0 , 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* line */ { 0 , 1 , 3 , 2 , - 1 , - 1 , - 1 , - 1 } , /* quad */ { 0 , 1 , 2 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* triangle */ { 0 , 1 , 3 , 2 , 4 , 5 , 7 , 6 } , /* hex */ { 0 , 2 , 1 , 3 , - 1 , - 1 , - 1 , - 1 } , /* tet */ { 0 , 2 , 1 , 3 , 5 , 4 , - 1 , - 1 } , /* prism */ { 0 , 1 , 3 , 2 , 4 , - 1 , - 1 , - 1 } /* pyramid */ \ #} +# Skipping MacroDefinition: T8_ECLASS_T8_TO_VTK_CORNER_NUMBER_VALUES { { 0 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* vertex */ { 0 , 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* line */ { 0 , 1 , 3 , 2 , - 1 , - 1 , - 1 , - 1 } , /* quad */ { 0 , 1 , 2 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* triangle */ { 0 , 1 , 3 , 2 , 4 , 5 , 7 , 6 } , /* hex */ { 0 , 2 , 1 , 3 , - 1 , - 1 , - 1 , - 1 } , /* tet */ { 0 , 2 , 1 , 3 , 5 , 4 , - 1 , - 1 } , /* prism */ { 0 , 1 , 3 , 2 , 4 , - 1 , - 1 , - 1 } /* pyramid */ \ #} +# Skipping MacroDefinition: T8_ECLASS_FACE_TYPES_VALUES { { - 1 , - 1 , - 1 , - 1 , - 1 , - 1 } , /* vertex */ { 0 , 0 , - 1 , - 1 , - 1 , - 1 } , /* line */ { 1 , 1 , 1 , 1 , - 1 , - 1 } , /* quad */ { 1 , 1 , 1 , - 1 , - 1 , - 1 } , /* triangle */ { 2 , 2 , 2 , 2 , 2 , 2 } , /* hex */ { 3 , 3 , 3 , 3 , - 1 , - 1 } , /* tet */ { 2 , 2 , 2 , 3 , 3 , - 1 } , /* prism */ { 3 , 3 , 3 , 3 , 2 , - 1 } /* pyramid */ \ #} +# Skipping MacroDefinition: T8_ECLASS_BOUNDARY_COUNT_VALUES { { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , /* vertex */ { 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , /* line */ { 4 , 4 , 0 , 0 , 0 , 0 , 0 , 0 } , /* quad */ { 3 , 3 , 0 , 0 , 0 , 0 , 0 , 0 } , /* triangle */ { 8 , 12 , 6 , 0 , 0 , 0 , 0 , 0 } , /* hex */ { 4 , 6 , 0 , 4 , 0 , 0 , 0 , 0 } , /* tet */ { 6 , 9 , 3 , 2 , 0 , 0 , 0 , 0 } , /* prism */ { 5 , 8 , 1 , 4 , 0 , 0 , 0 , 0 } /* pyramid */ \ #} - # Skipping MacroDefinition: T8_MPI_ELEMENT_SHAPE_TYPE ( T8_ASSERT ( sizeof ( int ) == sizeof ( t8_element_shape_t ) ) , sc_MPI_INT ) const T8_ELEMENT_SHAPE_MAX_FACES = 6 const T8_ELEMENT_SHAPE_MAX_CORNERS = 8 - const T8_VTK_LOCIDX = "Int32" const T8_VTK_GLOIDX = "Int32" @@ -17429,7 +17290,6 @@ const P4EST_MPI_QCOORD = sc_MPI_INT const P4EST_VTK_QCOORD = "Int32" - const P4EST_QCOORD_MIN = INT32_MIN const P4EST_QCOORD_MAX = INT32_MAX @@ -17444,7 +17304,6 @@ const P4EST_MPI_TOPIDX = sc_MPI_INT const P4EST_VTK_TOPIDX = "Int32" - const P4EST_TOPIDX_MIN = INT32_MIN const P4EST_TOPIDX_MAX = INT32_MAX @@ -17461,7 +17320,6 @@ const P4EST_MPI_LOCIDX = sc_MPI_INT const P4EST_VTK_LOCIDX = "Int32" - const P4EST_LOCIDX_MIN = INT32_MIN const P4EST_LOCIDX_MAX = INT32_MAX @@ -17476,17 +17334,12 @@ const P4EST_MPI_GLOIDX = sc_MPI_LONG_LONG_INT const P4EST_VTK_GLOIDX = "Int64" - const P4EST_GLOIDX_MIN = INT64_MIN const P4EST_GLOIDX_MAX = INT64_MAX const P4EST_GLOIDX_1 = p4est_gloidx_t(1) - - - - const P4EST_DIM = 2 const P4EST_FACES = 2P4EST_DIM @@ -17547,8 +17400,6 @@ const T8_CMESH_N_SUPPORTED_MSH_FILE_VERSIONS = 2 const T8_CMESH_FORMAT = 0x0002 - - # exports const PREFIXES = ["t8_", "T8_"] for name in names(@__MODULE__; all=true), prefix in PREFIXES From 334dc93f39af3577eb9af96c03b35c8eec9cfe54 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 09:34:07 +0100 Subject: [PATCH 12/24] we need variadic functions --- dev/generator.toml | 3 +- src/Libt8.jl | 85 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) diff --git a/dev/generator.toml b/dev/generator.toml index cb8fb06..a490602 100644 --- a/dev/generator.toml +++ b/dev/generator.toml @@ -343,7 +343,8 @@ opaque_as_mutable_struct = true use_ccall_macro = true # if true, variadic functions are wrapped with `@ccall` macro. Otherwise variadic functions are ignored. -wrap_variadic_function = false +# needed e.g. for t8_global_productionf +wrap_variadic_function = true # Generate getproperty/setproperty! methods for the types in the following list. # Warning: the generated methods will only work on the architecture that they diff --git a/src/Libt8.jl b/src/Libt8.jl index 6b62402..498ccce 100644 --- a/src/Libt8.jl +++ b/src/Libt8.jl @@ -2,6 +2,11 @@ module Libt8 using CEnum: CEnum, @cenum +to_c_type(t::Type) = t +to_c_type_pairs(va_list) = map(enumerate(to_c_type.(va_list))) do (ind, type) + :(va_list[$ind]::$type) +end + using t8code_jll: t8code_jll export t8code_jll @@ -102,6 +107,11 @@ function sc_abort_verbose(filename, lineno, msg) @ccall libt8.sc_abort_verbose(filename::Cstring, lineno::Cint, msg::Cstring)::Cvoid end +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function sc_abort_verbosef(filename, lineno, fmt, va_list...) + :(@ccall(libt8.sc_abort_verbosef(filename::Cstring, lineno::Cint, fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + """ sc_malloc(package, size) @@ -180,6 +190,11 @@ function sc_log(filename, lineno, package, category, priority, msg) @ccall libt8.sc_log(filename::Cstring, lineno::Cint, package::Cint, category::Cint, priority::Cint, msg::Cstring)::Cvoid end +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function sc_logf(filename, lineno, package, category, priority, fmt, va_list...) + :(@ccall(libt8.sc_logf(filename::Cstring, lineno::Cint, package::Cint, category::Cint, priority::Cint, fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + """ sc_array @@ -963,6 +978,11 @@ function sc_strcopy(dest, size, src) @ccall libt8.sc_strcopy(dest::Cstring, size::Csize_t, src::Cstring)::Cvoid end +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function sc_snprintf(str, size, format, va_list...) + :(@ccall(libt8.sc_snprintf(str::Cstring, size::Csize_t, format::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + """ sc_version() @@ -2916,6 +2936,11 @@ Communication tags used internal to t8code. T8_MPI_TAG_LAST = 302 end +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function t8_logf(category, priority, fmt, va_list...) + :(@ccall(libt8.t8_logf(category::Cint, priority::Cint, fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + """ t8_log_indent_push() @@ -2944,6 +2969,46 @@ function t8_log_indent_pop() @ccall libt8.t8_log_indent_pop()::Cvoid end +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function t8_global_errorf(fmt, va_list...) + :(@ccall(libt8.t8_global_errorf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function t8_global_essentialf(fmt, va_list...) + :(@ccall(libt8.t8_global_essentialf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function t8_global_productionf(fmt, va_list...) + :(@ccall(libt8.t8_global_productionf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function t8_global_infof(fmt, va_list...) + :(@ccall(libt8.t8_global_infof(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function t8_infof(fmt, va_list...) + :(@ccall(libt8.t8_infof(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function t8_productionf(fmt, va_list...) + :(@ccall(libt8.t8_productionf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function t8_debugf(fmt, va_list...) + :(@ccall(libt8.t8_debugf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function t8_errorf(fmt, va_list...) + :(@ccall(libt8.t8_errorf(fmt::Cstring; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + """ t8_set_external_log_fcn(log_fcn) @@ -5518,6 +5583,11 @@ Open modes for sc_io_open SC_IO_WRITE_APPEND = 2 end +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function sc_io_sink_new(iotype, iomode, ioencode, va_list...) + :(@ccall(libt8.sc_io_sink_new(iotype::Cint, iomode::Cint, ioencode::Cint; $(to_c_type_pairs(va_list)...))::Ptr{sc_io_sink_t})) + end + """ sc_io_sink_destroy(sink) @@ -5613,6 +5683,11 @@ function sc_io_sink_align(sink, bytes_align) @ccall libt8.sc_io_sink_align(sink::Ptr{sc_io_sink_t}, bytes_align::Csize_t)::Cint end +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function sc_io_source_new(iotype, ioencode, va_list...) + :(@ccall(libt8.sc_io_source_new(iotype::Cint, ioencode::Cint; $(to_c_type_pairs(va_list)...))::Ptr{sc_io_source_t})) + end + """ sc_io_source_destroy(source) @@ -10311,6 +10386,11 @@ function sc_keyvalue_new() @ccall libt8.sc_keyvalue_new()::Ptr{sc_keyvalue_t} end +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function sc_keyvalue_newf(dummy, va_list...) + :(@ccall(libt8.sc_keyvalue_newf(dummy::Cint; $(to_c_type_pairs(va_list)...))::Ptr{sc_keyvalue_t})) + end + """ sc_keyvalue_destroy(kv) @@ -15586,6 +15666,11 @@ function sc_flops_count(fi) @ccall libt8.sc_flops_count(fi::Ptr{sc_flopinfo_t})::Cvoid end +# automatic type deduction for variadic arguments may not be what you want, please use with caution +@generated function sc_flops_shotv(fi, va_list...) + :(@ccall(libt8.sc_flops_shotv(fi::Ptr{sc_flopinfo_t}; $(to_c_type_pairs(va_list)...))::Cvoid)) + end + mutable struct sc_options end """The options data structure is opaque.""" From 5ed75d9355583c17c431c8d1fb9b510215cf142c Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 09:35:38 +0100 Subject: [PATCH 13/24] docs --- dev/README.md | 12 ++++++++---- dev/generator.jl | 11 ++--------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/dev/README.md b/dev/README.md index 62924d3..bac11b7 100644 --- a/dev/README.md +++ b/dev/README.md @@ -38,7 +38,7 @@ julia +1.7 build_tarballs.jl --debug --verbose x86_64-linux-gnu --deploy=local This requires a local Julia installation and Julia version 1.7. You can use any other eligible platform triple instead of `x86_64-linux-gnu`. Adding `--deploy=local` will add -the created binaries to your local Julia aritfacts folder. +the created binaries to your local Julia artifacts folder. ## Updating `Tcode.jl` @@ -60,11 +60,15 @@ The crucial ingredients are the `t8code` header files, which are expected in a s - If you are developing `t8code` locally, you can copy and rename `t8code`'s `include` directory from its current prefix path. You will have to comment lines 5 and 6 (dealing with artifacts) in `generator.jl` then. - If your pull request to Yggdrasil has already been merged, you can find the newly built - binary packages at https://github.com/JuliaBinaryWrappers/t8code_jll.jl/releases. Pick an - asset and use its URL and hash to replace the current settings in `Artifacts.toml`. + binary packages at https://github.com/JuliaBinaryWrappers/t8code_jll.jl/releases. Copy an + entry of https://github.com/JuliaBinaryWrappers/t8code_jll.jl/blob/main/Artifacts.toml to + the local `Artifacts.toml` file. The exact choice of the platform triplet should not + matter since we use only the header files which are the same on each system. However, + they may matter in the presence of MPI headers since we apply some custom `fixes.sh` + afterwards. - If your pull request has not yet been accepted, you can instead use artifacts of the buildkite pipeline, see above. -- If you ran BindaryBuilder locally, you can somehow use your local atifacts. But how? +- If you ran BindaryBuilder locally, you can somehow use your local artifacts. But how? In any case run ```shell diff --git a/dev/generator.jl b/dev/generator.jl index 1565218..dde6d0b 100644 --- a/dev/generator.jl +++ b/dev/generator.jl @@ -7,15 +7,8 @@ cp(joinpath(artifact"t8code", "include"), "t8code_include"; force = true) using Glob -# This loads the artifact described in `P4est/dev/Artifacts.toml`. -# When a new release of P4est_jll.jl is created and you would like to update -# the headers, you can copy one of the entries of -# https://github.com/JuliaBinaryWrappers/P4est_jll.jl/blob/main/Artifacts.toml -# to this file. Here, we chose the version -# linux - x86_64 - glibc - mpich -# The exact choice should not matter since we use only the header files which -# are the same on each system. However, they may matter in the presence of -# MPI headers since we apply some custom `fixes.sh` afterwards. +# This loads the artifact described in `Artifacts.toml`. +# See REAMDE.md for instructions on how to update. using Clang.Generators # using Clang.LibClang.Clang_jll # replace this with your jll package From b46b7b8ad17d0b0dce0cf9169c66f19f457cb691 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 09:35:51 +0100 Subject: [PATCH 14/24] ignore false positive typo --- .typos.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/.typos.toml b/.typos.toml index 1cb9f7a..3b84325 100644 --- a/.typos.toml +++ b/.typos.toml @@ -3,3 +3,4 @@ consistend = "consistend" # is used in API function names... Inout = "Inout" leafs = "leafs" packageid = "packageid" +sc_MPI_MODE_WRONLY = "sc_MPI_MODE_WRONLY" From 75e39ad448bd809a35f1fdf40bf5b0446817759a Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 11:11:26 +0100 Subject: [PATCH 15/24] like this? --- .typos.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.typos.toml b/.typos.toml index 3b84325..748e059 100644 --- a/.typos.toml +++ b/.typos.toml @@ -3,4 +3,4 @@ consistend = "consistend" # is used in API function names... Inout = "Inout" leafs = "leafs" packageid = "packageid" -sc_MPI_MODE_WRONLY = "sc_MPI_MODE_WRONLY" +WRONLY = "WRONLY" # used in "sc_MPI_MODE_WRONLY" From ea5931cfb5354b90512267d5bc98499ae248e3a2 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 11:11:47 +0100 Subject: [PATCH 16/24] try julia 1.7 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 57e0934..99822dd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - julia-version: ['1.6', '1', 'nightly'] + julia-version: ['1.7', '1', 'nightly'] julia-arch: [x64, x86] os: [ubuntu-latest, windows-latest, macOS-latest] exclude: From 06b06d72fb621fefd56a2ce3cd4fd5430992fc78 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 11:22:05 +0100 Subject: [PATCH 17/24] adapt examples --- examples/t8_step2_uniform_forest.jl | 2 +- examples/t8_step3_adapt_forest.jl | 2 +- examples/t8_step4_partition_balance_ghost.jl | 2 +- examples/t8_step5_element_data.jl | 7 ++++--- examples/t8_step6_stencil.jl | 13 +++++++------ 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/examples/t8_step2_uniform_forest.jl b/examples/t8_step2_uniform_forest.jl index f50cd63..544719d 100644 --- a/examples/t8_step2_uniform_forest.jl +++ b/examples/t8_step2_uniform_forest.jl @@ -71,7 +71,7 @@ end # partitioned across the processes in \a comm. function t8_step2_build_uniform_forest(comm, cmesh, level) # /* Create the refinement scheme. */ - scheme = t8_scheme_new_default_cxx() + scheme = t8_scheme_new_default() # /* Creat the uniform forest. */ forest = t8_forest_new_uniform(cmesh, scheme, level, 0, comm) diff --git a/examples/t8_step3_adapt_forest.jl b/examples/t8_step3_adapt_forest.jl index d9e9bca..4c32b56 100644 --- a/examples/t8_step3_adapt_forest.jl +++ b/examples/t8_step3_adapt_forest.jl @@ -63,7 +63,7 @@ t8_global_productionf(" [step3] \n") # Build a cube cmesh with tet, hex, and prism trees. cmesh = t8_cmesh_new_hypercube_hybrid(comm, 0, 0) t8_global_productionf(" [step3] Created coarse mesh.\n") -forest = t8_forest_new_uniform(cmesh, t8_scheme_new_default_cxx(), level, 0, comm) +forest = t8_forest_new_uniform(cmesh, t8_scheme_new_default(), level, 0, comm) # Print information of the forest. t8_global_productionf(" [step3] Created uniform forest.\n") diff --git a/examples/t8_step4_partition_balance_ghost.jl b/examples/t8_step4_partition_balance_ghost.jl index c03b120..9108647 100644 --- a/examples/t8_step4_partition_balance_ghost.jl +++ b/examples/t8_step4_partition_balance_ghost.jl @@ -215,7 +215,7 @@ t8_global_productionf(" [step4] \n") # Build a cube cmesh with tet, hex, and prism trees. cmesh = t8_cmesh_new_hypercube_hybrid(comm, 0, 0) t8_global_productionf(" [step4] Created coarse mesh.\n") -forest = t8_forest_new_uniform(cmesh, t8_scheme_new_default_cxx(), level, 0, comm) +forest = t8_forest_new_uniform(cmesh, t8_scheme_new_default(), level, 0, comm) # Print information of the forest. t8_step3_print_forest_information(forest); diff --git a/examples/t8_step5_element_data.jl b/examples/t8_step5_element_data.jl index 5b54a07..ef67622 100644 --- a/examples/t8_step5_element_data.jl +++ b/examples/t8_step5_element_data.jl @@ -59,7 +59,7 @@ end function t8_step5_build_forest(comm, level) cmesh = t8_cmesh_new_hypercube_hybrid(comm, 0, 0) - scheme = t8_scheme_new_default_cxx() + scheme = t8_scheme_new_default() adapt_data = t8_step3_adapt_data_t((0.5, 0.5, 1.0), # Midpoints of the sphere. 0.2, # Refine if inside this radius. @@ -118,6 +118,8 @@ function t8_step5_create_element_data(forest) # Get the number of trees that have elements of this process. num_local_trees = t8_forest_get_num_local_trees(forest) + scheme = t8_forest_get_scheme(forest) + current_index = 0 for itree in 0:(num_local_trees - 1) # This loop iterates through all local trees in the forest. @@ -125,7 +127,6 @@ function t8_step5_create_element_data(forest) # also a different way to interpret its elements. In order to be able to handle elements # of a tree, we need to get its eclass_scheme, and in order to so we first get its eclass. tree_class = t8_forest_get_tree_class(forest, itree) - eclass_scheme = t8_forest_get_eclass_scheme(forest, tree_class) # Get the number of elements of this tree. num_elements_in_tree = t8_forest_get_tree_num_elements(forest, itree) @@ -141,7 +142,7 @@ function t8_step5_create_element_data(forest) # We want to store the elements level and its volume as data. We compute these # via the eclass_scheme and the forest_element interface. - level = t8_element_level(eclass_scheme, element) + level = t8_element_get_level(scheme, tree_class, element) volume = t8_forest_element_volume(forest, itree, element) element_data[current_index] = t8_step5_data_per_element_t(level, volume) diff --git a/examples/t8_step6_stencil.jl b/examples/t8_step6_stencil.jl index 771824d..88e9038 100644 --- a/examples/t8_step6_stencil.jl +++ b/examples/t8_step6_stencil.jl @@ -78,7 +78,7 @@ end function t8_step6_build_forest(comm, dim, level) cmesh = t8_cmesh_new_periodic(comm, dim) - scheme = t8_scheme_new_default_cxx() + scheme = t8_scheme_new_default() adapt_data = t8_step3_adapt_data_t((0.0, 0.0, 0.0), # Midpoints of the sphere. 0.5, # Refine if inside this radius. @@ -130,11 +130,12 @@ function t8_step6_create_element_data(forest) # Element Midpoint midpoint = Vector{Cdouble}(undef, 3) + scheme = t8_forest_get_scheme(forest) + # Loop over all local trees in the forest. current_index = 0 for itree in 0:(num_local_trees - 1) tree_class = t8_forest_get_tree_class(forest, itree) - eclass_scheme = t8_forest_get_eclass_scheme(forest, tree_class) # Get the number of elements of this tree. num_elements_in_tree = t8_forest_get_tree_num_elements(forest, itree) @@ -145,16 +146,16 @@ function t8_step6_create_element_data(forest) element = t8_forest_get_element_in_tree(forest, itree, ielement) - level = t8_element_level(eclass_scheme, element) + level = t8_element_get_level(scheme, tree_class, element) volume = t8_forest_element_volume(forest, itree, element) t8_forest_element_centroid(forest, itree, element, pointer(midpoint)) - t8_element_vertex_reference_coords(eclass_scheme, element, 0, + t8_element_get_vertex_reference_coords(scheme, tree_class, element, 0, @view(verts[:, 1])) - t8_element_vertex_reference_coords(eclass_scheme, element, 1, + t8_element_get_vertex_reference_coords(scheme, tree_class, element, 1, @view(verts[:, 2])) - t8_element_vertex_reference_coords(eclass_scheme, element, 2, + t8_element_get_vertex_reference_coords(scheme, tree_class, element, 2, @view(verts[:, 3])) dx = verts[1, 2] - verts[1, 1] From a9911c2cd53bce706c45c156393d43d65891f5d8 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 11:24:45 +0100 Subject: [PATCH 18/24] try julia 1.8 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 99822dd..48ecbab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - julia-version: ['1.7', '1', 'nightly'] + julia-version: ['1.8', '1', 'nightly'] julia-arch: [x64, x86] os: [ubuntu-latest, windows-latest, macOS-latest] exclude: From 6ec46d244fb2d98327dd35a86f758c9cd10b2643 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 11:25:15 +0100 Subject: [PATCH 19/24] typo --- dev/generator.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/generator.jl b/dev/generator.jl index dde6d0b..1726446 100644 --- a/dev/generator.jl +++ b/dev/generator.jl @@ -8,7 +8,7 @@ cp(joinpath(artifact"t8code", "include"), "t8code_include"; force = true) using Glob # This loads the artifact described in `Artifacts.toml`. -# See REAMDE.md for instructions on how to update. +# See README.md for instructions on how to update. using Clang.Generators # using Clang.LibClang.Clang_jll # replace this with your jll package From a00e47ddb5ceea2666e51aaf3936e722cdf83f6c Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 12:24:16 +0100 Subject: [PATCH 20/24] more adaptations --- examples/t8_step2_uniform_forest.jl | 4 ++-- examples/t8_step3_common.jl | 15 ++++++++------- examples/t8_step5_element_data.jl | 8 ++++---- examples/t8_step6_stencil.jl | 2 +- test/test_examples.jl | 6 +++--- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/examples/t8_step2_uniform_forest.jl b/examples/t8_step2_uniform_forest.jl index 544719d..cfde830 100644 --- a/examples/t8_step2_uniform_forest.jl +++ b/examples/t8_step2_uniform_forest.jl @@ -127,9 +127,9 @@ cmesh = t8_step2_build_prismcube_coarse_mesh(mpicom) # Build the uniform forest, it is automatically partitioned among the processes. forest = t8_step2_build_uniform_forest(mpicom, cmesh, level) # Get the local number of elements. -local_num_elements = t8_forest_get_local_num_elements(forest) +local_num_elements = t8_forest_get_local_num_leaf_elements(forest) # Get the global number of elements. -global_num_elements = t8_forest_get_global_num_elements(forest) +global_num_elements = t8_forest_get_global_num_leaf_elements(forest) # Print information on the forest. t8_global_productionf(" [step2] Created uniform forest.\n") diff --git a/examples/t8_step3_common.jl b/examples/t8_step3_common.jl index bc263b6..abc5c23 100644 --- a/examples/t8_step3_common.jl +++ b/examples/t8_step3_common.jl @@ -16,17 +16,18 @@ end # return > 0 -> The first element should get refined. # return = 0 -> The first element should not get refined. # return < 0 -> The whole family should get coarsened. -# +# # \param [in] forest The current forest that is in construction. # \param [in] forest_from The forest from which we adapt the current forest (in our case, the uniform forest) # \param [in] which_tree The process local id of the current tree. +# \param [in] tree_class The eclass of \a which_tree. # \param [in] lelement_id The tree local index of the current element (or the first of the family). -# \param [in] ts The refinement scheme for this tree's element class. -# \param [in] is_family if 1, the first \a num_elements entries in \a elements form a family. If 0, they do not. +# \param [in] scheme The refinement scheme for this tree's element class. +# \param [in] is_family If 1, the first \a num_elements entries in \a elements form a family. If 0, they do not. # \param [in] num_elements The number of entries in \a elements elements that are defined. # \param [in] elements The element or family of elements to consider for refinement/coarsening. -function t8_step3_adapt_callback(forest, forest_from, which_tree, lelement_id, - ts, is_family, num_elements, elements_ptr)::Cint +function t8_step3_adapt_callback(forest, forest_from, which_tree, tree_class, lelement_id, + scheme, is_family, num_elements, elements_ptr)::Cint # Our adaptation criterion is to look at the midpoint coordinates of the current element and if # they are inside a sphere around a given midpoint we refine, if they are outside, we coarsen. @@ -96,9 +97,9 @@ function t8_step3_print_forest_information(forest) @T8_ASSERT(t8_forest_is_committed(forest)==1) # Get the local number of elements. - local_num_elements = t8_forest_get_local_num_elements(forest) + local_num_elements = t8_forest_get_local_num_leaf_elements(forest) # Get the global number of elements. - global_num_elements = t8_forest_get_global_num_elements(forest) + global_num_elements = t8_forest_get_global_num_leaf_elements(forest) t8_global_productionf(" [step3] Local number of elements:\t\t%i\n", local_num_elements) t8_global_productionf(" [step3] Global number of elements:\t%li\n", global_num_elements) diff --git a/examples/t8_step5_element_data.jl b/examples/t8_step5_element_data.jl index ef67622..ca27223 100644 --- a/examples/t8_step5_element_data.jl +++ b/examples/t8_step5_element_data.jl @@ -88,7 +88,7 @@ function t8_step5_create_element_data(forest) @T8_ASSERT(t8_forest_is_committed(forest)==1) # Get the number of local elements of forest. - num_local_elements = t8_forest_get_local_num_elements(forest) + num_local_elements = t8_forest_get_local_num_leaf_elements(forest) # Get the number of ghost elements of forest. num_ghost_elements = t8_forest_get_num_ghosts(forest) @@ -179,7 +179,7 @@ end # We support two types: T8_VTK_SCALAR - One double per element # and T8_VTK_VECTOR - 3 doubles per element function t8_step5_output_data_to_vtu(forest, element_data, prefix) - num_elements = t8_forest_get_local_num_elements(forest) + num_elements = t8_forest_get_local_num_leaf_elements(forest) # We need to allocate a new array to store the volumes on their own. # This array has one entry per local element. */ element_volumes = Vector{Cdouble}(undef, num_elements) @@ -256,7 +256,7 @@ element_data = t8_step5_create_element_data(forest) t8_global_productionf(" [step5] Computed level and volume data for local elements.\n") -if t8_forest_get_local_num_elements(forest) > 0 +if t8_forest_get_local_num_leaf_elements(forest) > 0 # Output the stored data of the first local element (if it exists). t8_global_productionf(" [step5] Element 0 has level %i and volume %e.\n", element_data[1].level, element_data[1].volume) @@ -270,7 +270,7 @@ t8_global_productionf(" [step5] Exchanged ghost data.\n") if t8_forest_get_num_ghosts(forest) > 0 # Output the data of the first ghost element (if it exists). - first_ghost_index = t8_forest_get_local_num_elements(forest) + first_ghost_index = t8_forest_get_local_num_leaf_elements(forest) t8_global_productionf(" [step5] Ghost 0 has level %i and volume %e.\n", element_data[first_ghost_index + 1].level, element_data[first_ghost_index + 1].volume) diff --git a/examples/t8_step6_stencil.jl b/examples/t8_step6_stencil.jl index 88e9038..010b731 100644 --- a/examples/t8_step6_stencil.jl +++ b/examples/t8_step6_stencil.jl @@ -111,7 +111,7 @@ function t8_step6_create_element_data(forest) @T8_ASSERT(t8_forest_is_committed(forest)==1) # Get the number of local elements of forest. - num_local_elements = t8_forest_get_local_num_elements(forest) + num_local_elements = t8_forest_get_local_num_leaf_elements(forest) # Get the number of ghost elements of forest. num_ghost_elements = t8_forest_get_num_ghosts(forest) diff --git a/test/test_examples.jl b/test/test_examples.jl index 2610d74..6abc5af 100644 --- a/test/test_examples.jl +++ b/test/test_examples.jl @@ -1,4 +1,3 @@ - # This file makes sure to run all examples within the testing suite too. # It does not add extra sanity checks, assertions etc. to the examples, # but is intended to make sure the examples run without throwing errors. @@ -25,8 +24,9 @@ end # Unfortunately, step 5 and step 6 currently crash (1.) in Windows, (2.) in MacOS, # and (3.) with Julia older than 1.9, see related issues -# https://github.com/DLR-AMR/T8code.jl/issues/26, https://github.com/DLR-AMR/T8code.jl/issues/30, -# and https://github.com/DLR-AMR/T8code.jl/issues/104. +# https://github.com/DLR-AMR/T8code.jl/issues/26, +# https://github.com/DLR-AMR/T8code.jl/issues/30, +# https://github.com/DLR-AMR/T8code.jl/issues/104. # Until they are resolved, the two cases are skipped. # @testset "t8_step5_element_data" begin From 3453b8548b7a10106294f8ff0c1523ce5066063a Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 12:31:27 +0100 Subject: [PATCH 21/24] fmt --- examples/t8_step6_stencil.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/t8_step6_stencil.jl b/examples/t8_step6_stencil.jl index 010b731..8c9b6d4 100644 --- a/examples/t8_step6_stencil.jl +++ b/examples/t8_step6_stencil.jl @@ -152,11 +152,11 @@ function t8_step6_create_element_data(forest) t8_forest_element_centroid(forest, itree, element, pointer(midpoint)) t8_element_get_vertex_reference_coords(scheme, tree_class, element, 0, - @view(verts[:, 1])) + @view(verts[:, 1])) t8_element_get_vertex_reference_coords(scheme, tree_class, element, 1, - @view(verts[:, 2])) + @view(verts[:, 2])) t8_element_get_vertex_reference_coords(scheme, tree_class, element, 2, - @view(verts[:, 3])) + @view(verts[:, 3])) dx = verts[1, 2] - verts[1, 1] dy = verts[2, 3] - verts[2, 1] From e60816306578b92d7bd5ed02ea2f0fb23b0f14b5 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 12:31:36 +0100 Subject: [PATCH 22/24] try 1.9 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 48ecbab..eb3acd2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,7 +36,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - julia-version: ['1.8', '1', 'nightly'] + julia-version: ['1.9', '1', 'nightly'] julia-arch: [x64, x86] os: [ubuntu-latest, windows-latest, macOS-latest] exclude: From c74c474229ab662c0b92a11961a280c1fbbc441e Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 12:46:46 +0100 Subject: [PATCH 23/24] allow concurrent jobs for the time being --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb3acd2..7b8b518 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,9 +27,9 @@ on: - '.gitignore' # Cancel redundant CI tests automatically -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true +#concurrency: +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: true jobs: test: From 06939000bf04694dbd0d6c570a7760140b3dd331 Mon Sep 17 00:00:00 2001 From: Benedict Geihe Date: Wed, 7 Jan 2026 12:54:36 +0100 Subject: [PATCH 24/24] that is the way --- .github/workflows/test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7b8b518..7058936 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,14 +27,15 @@ on: - '.gitignore' # Cancel redundant CI tests automatically -#concurrency: -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: true +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: test: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: julia-version: ['1.9', '1', 'nightly'] julia-arch: [x64, x86]